Ten years after faulty mortgages upended the global financial system, Wells Fargo & Co. agreed to pay $2.09 billion to settle a U.S. probe into its creation and sale of loans that contributed to the disaster.

The long-anticipated penalty, announced Wednesday, is in line with what some analysts had predicted and smaller than sanctions borne by some of the bank’s competitors. But the case offers a new look behind the scenes at decisions made inside one of the nation’s largest home lenders before the crisis — and the evidence executives once saw of mounting trouble.

Investors including federally insured financial institutions ended up suffering billions of dollars in losses on securities that contained home loans from Wells Fargo, the Department of Justice said in a statement announcing the accord. The probe focuses on debts in which borrowers were allowed to declare their incomes, without providing proof.

“Abuses in the mortgage-backed securities industry led to a financial crisis that devastated millions of Americans,” Alex Tse, the acting U.S. attorney for the Northern District of California, said in the statement. “Today’s agreement holds Wells Fargo responsible for originating and selling tens of thousands of loans that were packaged into securities and subsequently defaulted.”

‘Astounding’ Results

The firm set out in 2005 to double production of two types of risky mortgages, known as subprime and Alt-A. As part of the push, it loosened requirements for stated-income loans, the government said. Yet the bank’s sampling and testing of the debts showed signs that information submitted was too often inaccurate, investigators found.

As the test results circulated within the bank, one employee in risk management called them “astounding,” the Justice Department said. Yet, the employee said, “instead of reacting in a way consistent with what is being reported” the bank was expanding stated-income lending.

U.S. probes into banks’ lending practices before the crisis continue to roll on. Wells Fargo’s accord may ultimately mark the Justice Department’s last multibillion-dollar penalty against a U.S. company for creating or selling crisis-era mortgages. Still, a number of overseas firms, such as UBS Group AG and HSBC Holdings Plc, have yet to resolve significant probes.

Wells Fargo set aside funds for the settlement before midyear, it said in a statement. Shares of the bank pared earlier gains, but were still up 0.6 percent as of 4 p.m. in New York.

“We are pleased to put behind us these legacy issues regarding claims related to residential mortgage-backed securities activities that occurred more than a decade ago,” Chief Executive Officer Tim Sloan said in the statement.

The San Francisco-based lender has been signaling the settlement’s approach. In January, Chief Financial Officer John Shrewsberry told Bloomberg his firm would likely hash out terms this year. While he declined to discuss the potential cost, the firm took a $3.3 billion litigation charge late in 2017, mainly for mortgage-related issues. Bloomberg Intelligence analyst Elliott Stein had estimated the settlement for mortgage-backed securities could cost more than $2 billion.

The government’s complaint relies on the Financial Institutions Reform, Recovery and Enforcement Act — known as Firrea — a law that’s allowed authorities to sue banks years later over mortgages that burned federally insured financial institutions.

U.S. investigators cited tests of Wells Fargo mortgages that compared them with borrowers’ tax filings, revealing that more than 70 percent of loans sampled “had an unacceptable discrepancy between stated and actual income,” according to the Justice Department’s statement.

“Despite its knowledge that a substantial portion of its stated income loans contained misstated income, Wells Fargo failed to disclose this information,” the Justice Department said. The bank even took steps to “insulate itself” from the risks posed by such loans, screening many of them out of its own portfolio and limiting its liability to third parties, the government said.