Wells Fargo & Co. announced Wednesday morning in a filing with the Securities and Exchange Commission that it will pay $1.2 billion to settle claims that it engaged in reckless lending under its Federal Housing Administration program in the years that led up to the housing crash.

The San Francisco-based bank had been in talks with the government ever since the U.S. Department of Justice sued it in October 2012 over accusations that it "engaged in a regular practice of reckless origination and underwriting" of FHA loans, which are backed by federal insurance and typically made to help first-time home buyers and those with lower incomes, reported The Los Angeles Times.

Prosecutors argued that the bank issued thousands of loans that failed to meet FHA requirements between 2001 and 2005. They also claim that the bank violated requirements to keep problem loans under wraps between 2002 and 2010.

This meant that when any of those loans went bad, the FHA would pay millions of dollars in insurance claims, even though none of those loans would have met FHA approval.

To prepare for the extra legal expense, the company added $200 million to its non-interest expense last year, effectively reducing the company's 2015 net income by $134 million to $22.9 billion, according to Reuters.

Wells Fargo is the latest lender to resolve federal lawsuits over FHA-insured loans. Other lenders like Bank of America, JP Morgan, Bank of America and Citigroup have all resolved similar suits in the last few years, resolving to cut back on FHA lending in the future since it invites too much risk of legal entanglements.

Wells Fargo CFO John Shrews said at a September investor conference that the bank, like others, will cut back on such loans in the future, especially to riskier borrowers.

"Those are the loans that are going to default, and those are the defaults we are going to be arguing about 10 years from now," Shrews said.