Wells Fargo & Co. admitted to deceiving the U.S. government into insuring thousands of risky mortgages, as it formally reached a record $1.2 billion settlement of a U.S. Department of Justice lawsuit.

The settlement with Wells Fargo, the largest U.S. mortgage lender and third-largest U.S. bank by assets, was filed on Friday in Manhattan federal court. It also resolves claims against Kurt Lofrano, a former Wells Fargo vice president.

According to the settlement, Wells Fargo "admits, acknowledges, and accepts responsibility" for having from 2001 to 2008 falsely certified that many of its home loans qualified for Federal Housing Administration insurance.

The San Francisco-based lender also admitted to having from 2002 to 2010 failed to file timely reports on several thousand loans that had material defects or were badly underwritten, a process that Lofrano was responsible for supervising.

According to the Justice Department, the shortfalls led to substantial losses for taxpayers when the FHA was forced to pay insurance claims as defective loans soured.

Several lenders, including Bank of America Corp., Citigroup Inc., Deutsche Bank AG and JPMorgan Chase & Co., previously settled similar federal lawsuits.

But Wells Fargo held out, and its payment is the largest in FHA history over loan origination violations.

Friday's settlement is a reproach for "years of reckless underwriting" at Wells Fargo, U.S. Attorney Preet Bharara in New York City said in a statement.

"While Wells Fargo enjoyed huge profits from its FHA loan business, the government was left holding the bag when the bad loans went bust," Bharara added.

The accord also resolved a probe by federal prosecutors in California of alleged false loan certifications by American Mortgage Network LLC, which Wells Fargo bought in 2009.

No one has been criminally charged in the probes, and the Justice Department reserved the right to pursue criminal charges if it wishes, according to the settlement.

Franklin Codel, president of Wells Fargo Home Lending, in a statement said the settlement "allows us to put the legal process behind us, and to focus our resources and energy on what we do best -- serving the needs of the nation's homeowners."

Lewis Liman, a lawyer for Lofrano, did not immediately respond to requests for comment.

Wells Fargo on Feb. 3 said the settlement would reduce its previously reported 2015 profit by $134 million, to account for extra legal expenses.

The case is U.S. v. Wells Fargo Bank NA, U.S. District Court, Southern District of New York, No. 12-07527.