A federal judge has approved a $25 billion settlement between government officials and some of the nation’s largest banks over shoddy foreclosure practices.

U.S. District Judge Rosemary Collyer signed off on the landmark deal on Wednesday, according to court documents, nearly two months after it was announced with great fanfare at the Jutice Department. Her approval became public Thursday afternoon.

The settlement forces the five banks involved — Wells Fargo, Citigroup, Bank of America, JPMorgan Chase and Ally Financial — to overhaul the flawed and fraudulent foreclosure practices that had become rampant in recent years.

It compels the firms to write down the loan balances for a certain portion of homeowners, help others refinance at lower interest rates and pay restitution to some borrowers who lost their homes to foreclosure.

In addition, banks must pay for an independent monitor to oversee and enforce the terms of the deal over the next several years.