State and federal officials on Thursday announced a settlement of more than $25 billion with five of the nation’s banks over flawed and fraudulent foreclosure practices that affected several million homeowners and became commonplace after the housing boom turned to bust in recent years. It is the largest government-industry settlement in more than a decade.

The deal marks the culmination of more than 16 months of negotiation between lenders and a collection of state and federal officials. It aims to help troubled borrowers by requiring the banks to reduce the amount borrowers owe on their mortgages, lowering their interest rates and paying restitution to homeowners who suffered mortgage-related abuses. It will force lenders to revamp how they interact with struggling mortgage holders and bar them from trying to foreclose on borrowers while simultaneously negotiating mortgage modifications.