The federal government and 49 states have reached a landmark $25 billion foreclosure settlement with the nation’s five largest mortgage lenders, the Department of Justice announced Thursday.

The joint agreement is the largest federal-state civil settlement ever obtained.

U.S. Attorney General Eric Holder, Department of Housing (HUD) Secretary Shaun Donovan, Iowa Attorney General Tom Mill and Colorado Attorney General John W. Suthers announced today the federal government and 49 states agreed to the deal, which has been in the works for more than a year.

“This agreement – the largest joint federal-state settlement ever obtained – is the result of unprecedented cooperation among enforcement agencies throughout the government,” Holder said in a release Thursday.

“It holds mortgage servicer companies accountable for abusive practices and requires them to commit more than $20 billion towards financial relief for consumers. As a result, struggling homeowners throughout the country will benefit from reduced principals and refinancing of their loans. The agreement also requires substantial changes in how servicers do business, which will ensure the abuses of the past are not repeated.”

The joint federal-state agreement requires mortgage lenders to implement new mortgage loan servicing standards and to commit billions of dollars to resolve violations of state and federal law, including robo-signing, deceptive practices used in loan modifications, failure to offer non-foreclosure alternatives before foreclosing on borrowers and filing improper court documentation upon bankruptcy or foreclosure.

The requirements of the agreement as they were laid out in Thursday’s press release:

— Mortgage lenders are required to collectively dedicate $20 billion towards various forms of financial relief to borrowers. At least $10 billion will go toward reducing the principal on loans for at-risk borrowers.

— At least $3 billion will go toward refinancing loans for borrowers who are current on their mortgages but are still underwater.

— Up to $7 billion will go toward other forms of relief, including forbearance of principal for unemployed homeowners, short sales and transitional assistance, benefits for service members who are forced to sell their home at a loss as the result of a Permanent Change in Station order and other programs.

— Mortgage lenders must pay $5 billion in cash to the federal and state governments, $1.5 billion of which will be used to establish a Borrower Payment Fund. This fund will provide cash payments to borrowers whose homes were sold or taken in foreclosure between January 1, 2008 and December 21, 2011, and who meet other criteria.

The remaining $3.5 billion of the $5 billion payment will go to state and federal governments to be used to repay public funds lost as a result of lender misconduct and to fund public programs to help consumers, as determined by the state attorneys general.

According to Donovan, “This historic settlement will provide immediate relief to homeowners, forcing banks to reduce the principal balance on many loans, refinance loans for underwater borrowers and pay billions of dollars to states and consumers.”

“Banks must follow the laws. Any bank that hasn’t done so should be held accountable and should take prompt action to correct its mistakes. And it will not end with this settlement,” Donovan said.

Mortgage lenders are required to fulfill the obligations outlined in the settlement within three years, but according to the release there are incentives which encourage them to help consumers within 12 months. The new loan servicing standards provide for stricter oversight of the foreclosure process, and foreclosure should now be considered a last resort.

The $5 billion payout to federal and state governments includes a $1 billion resolution of an investigation into fraudulent and wrongful conduct by Bank of America and various Countrywide entities.

For more information about the settlement, go to www.NationalMortgageSettlement.com. To find your state attorney general’s website, go to www.NAAG.org and click on “The Attorneys General.”

If you’re a homeowner and have questions about whether you qualify for a loan modification or refinancing under the Home Affordable Refinance Program (also known as HARP 2.0), contact the Homeowner’s HOPE hotline at 1-888-995-HOPE or go to MakingHomeAffordable.gov.