Government officials on Monday asked a federal judge to approve a landmark settlement with some of the nation’s largest banks over flawed and fraudulent foreclosure practices, more than a month after they announced the $25 billion deal with fanfare at the Justice Department.

The 99-page complaint filed in a D.C. federal court details the “pattern of unfair and deceptive practices” perpetrated by banks in the wake of the housing bust. Among them: filing false and misleading court affidavits, charging excessive and improper fees to borrowers, keeping abysmal records, frequently losing paperwork, breaking promises to homeowners trying to modify their loans, employing staff with little or no training, and improperly foreclosing on active-duty military members.

Officials filed separate and lengthy settlement terms with the five banks involved — Bank of America, J.P. Morgan Chase, Wells Fargo, Ally Financial and Citigroup — that document the penalties each must pay, how that money will be distributed, how new mortgage-servicing standards will be enforced and the extent of the legal releases the firms will receive as part of the deal.

Although the dollar amounts differ, the agreements with each bank are largely the same. One exception is a side deal in which Bank of America agreed to reduce loan balances for as many as 200,000 borrowers who owe more than their homes are worth. The average amount of those principal reductions is expected to be more than $100,000, and it will reduce the amount of penalties the firm owes by about $850 million.

Monday’s filing came after nearly 17 months of negotiations between state and federal officials and the nation’s largest banks. Those talks began in late 2010 after widespread outrage over news that banks were using forged and shoddy paperwork to churn through massive numbers of foreclosures, a practice that became known as “robo-signing.” Forty-nine states ultimately signed on to the deal; Oklahoma crafted a separate settlement.

The settlement is intended to help troubled homeowners by requiring the banks to reduce the amount some borrowers owe on their mortgages, lower interest rates for others and pay restitution to homeowners who suffered mortgage-related abuses. It also will force lenders to overhaul their mortgage-servicing practices, including revamping how they interact with struggling mortgage holders and barring them from trying to foreclose on borrowers while simultaneously negotiating mortgage modifications.

Under the terms of the deal, banks would have three years to complete principal writedowns, refinancings and other relief. The settlement includes incentives for actions taken within the first 12 months.

The deal also includes about $17 billion that would fund a range of foreclosure-prevention measures, the majority of which would go toward lowering the loan balance for borrowers who owe more than their homes are worth. Other provisions would provide $3 billion for lowering interest rates for homeowners who are current on their loans. In addition, as many as 750,000 borrowers who lost their homes to foreclosure since 2008 would be eligible for payouts of about $2,000 each.

About $2.5 billion would go directly to states and is intended to pay for housing and foreclosure-prevention efforts such as counseling, mediation and legal assistance. But officials in Wisconsin and Missouri have said they plan divert some of their funds to help plug budget shortfalls.

All five banks also agreed to provide broad relief to military service members who were harmed by mortgage-related misdeeds. In cases where federal officials determine that a bank improperly foreclosed on a service member, for example, the firm will be required to pay that homeowner $116,785 or more, plus any lost equity in the property. In addition, J.P. Morgan Chase agreed to pay the federal government $45 million to settle a lawsuit alleging that it cheated military veterans and taxpayers out of millions of dollars by hiding illegal fees in refinancing transactions.

Monday’s filing also details the powers that former North Carolina banking supervisor Joseph Smith will have in his role as a full-time overseer and enforcer of the agreement.The banks must submit to quarterly reviews and will face penalties if they fall short of the standards established by the settlement.

The deal gives banks a broad release from legal liability over “robo-signing” practices and a swath of other transgressions, such as their lax underwriting practices and their failure to properly modify loans for homeowners who qualified for adjustments.

It leaves open the door for other types of litigation, including fair-housing and fair-lending violations, as well as civil rights claims. It doesn’t bar individuals from joining class-action lawsuits or prevent private investors from seeking damages, and it preserves the possibility for future lawsuits over the way banks bundled and sold mortgages, a process called securitization.

Well before Monday’s settlement filing, the deal had been criticized for being unlikely to have a broad effect on the sagging housing market, given the scope of the problems that remain. Government officials who crafted the deal acknowledge that the final sum will reach only a fraction of homeowners across the country whose homes are collectively worth $750 billion less than what is owed on their mortgages.

But officials say it will provide much-needed relief to some, and represents a meaningful step in halting the shoddy foreclosure practices of recent years and in nudging the housing market toward firmer footing.

In fact, banks have faced a barrage of public and private lawsuits and investigations in recent years, with more likely on the way. Groups including large investors and the Federal Housing Finance Agency have filed suit against the firms, alleging a range of mortgage-related misdeeds and seeking billions of dollars in damages.

Earlier this year, President Obama announced a new effort to expand investigations into abusive lending and securitization practices, and soon after, Attorney General Eric H. Holder Jr. said Justice had issued civil subpoenas to 11 financial institutions. In addition, numerous state attorneys general have launched other investigations, filed lawsuits and issued subpoenas.

With the landmark settlement on the brink of completion, officials say they now hope that additional banks will soon sign onto similar agreements and adopt the new mortgage-servicing standards outlined in the deal.

Homeowners interested in learning more about eligibility requirements for aid or finding contact information for the banks and government agencies involved can visit the Web site www.nationalmortgage­

Staff writer Steve Vogel contributed to this report.