The US Department of Justice will pay a record $1 billion to about a dozen mortgage servicers to resolve allegations of widespread mortgage fraud, including the sale of fake mortgages and the sale or transfer of subprime mortgages, the Justice Department said Thursday.

In a letter to mortgage servicer representatives, Attorney General Jeff Sessions announced the settlement with Ally Financial Inc, a subsidiary of Wells Fargo & Co., a unit of JP Morgan Chase &amp.; Sullivan &amp.

Gore.

The department also will pay $700 million to the Federal Housing Finance Agency (FHFA), a department agency responsible for overseeing the sale and servicing of substandard mortgages.

The settlement was approved by a federal judge in the Northern District of California and the U.S. Court of Appeals for the Federal Circuit, a court that has sided with banks in the past on mortgage fraud cases.

In addition to Ally Financial, the settlement includes Countrywide Financial Corp., Home Capital Group, National Association of Home Mortgage Lenders, Nationwide Mortgage Corporation, and Wells Fargo Mortgage Lending.

It is the first time a federal agency has paid out such large sums in mortgage fraud charges, the department said.

A federal judge previously ordered the DOJ to pay the companies $3 billion, saying Ally failed to properly disclose the nature of the fraud and the extent of its losses.

In its letter, the DOJ said the banks have a history of fraudulent mortgage servicing and have repeatedly failed to fix problems.

The investigation focused on loans originated by Ally, Wells Fargo, National Assurance Mortgage Corporation and other firms, the letter said.

The cases are part of a multi-million dollar settlement agreement between the Justice and the mortgage lenders that the Department struck in 2016.

The settlements, if approved, would be the largest since 2009 when a separate Justice Department agreement paid $2 billion to the mortgage servicaries for mortgage fraud.

The DOJ said it would use proceeds from the settlement to support a number of federal programs, including consumer education programs and criminal prosecutions.

The largest amount of money paid by the DOJ was $1,000 million for mortgage servicals that failed to disclose the existence of the mortgage fraud scheme in its disclosures to mortgage lenders, the agency said.