Wells Fargo on Thursday formally challenged a fraudulent mortgage lawsuit filed by federal prosecutors last month, arguing in court that an existing settlement with the government clears it of liability.

The U.S. attorney’s office in Manhattan sued Wells Fargo in September for “reckless” and fraudulent mortgage practices that saddled the Federal Housing Administration with hundreds of million of dollars in insurance claims when those loans went bad.

But the San Francisco-based banking giant said this lawsuit violates the conditions of a settlement with state and federal attorneys over widespread foreclosure abuses that was approved in April, according to a motion filed in federal court in the District. Wells Fargo was one of five large banks to agree to pony up money for the $25 billion national settlement.

The case could have far reaching implications for some of the nation’s largest banks that are party to the mortgage settlement and are also facing a barrage of related lawsuits, analysts say. If the federal judge sides with Wells Fargo, mortgage lenders such as Bank of America and JPMorgan Chase could use the case as the basis to ward off federal litigation.

In its filing Thursday, Wells Fargo said the government agreed not to bring any claims based on the bank’s FHA participation, unless it could prove individual underwriters knowingly certified loans that did not meet the agency’s insurance requirements.

“Wells Fargo committed billions to the United States in settlement . . . and should be able to rely on the United States to observe and abide by its commitments and representations,” the bank said in its filing.

Officials from the U.S. attorney’s office in Manhattan and the Department of Housing and Urban Development, which oversees the FHA, declined to comment.

The U.S. attorney accused Wells Fargo of certifying at least 6,320 shoddy mortgages for FHA insurance that it knew were poorly underwritten. Prosecutors say the bank routinely ignored warnings from its own employees of loans rife with serious violation or fraud. Instead, the bank rewarded poorly trained staff for pumping out bad loans.

The case boils down to whether the national foreclosure settlement released Wells Fargo from liability on loans insured by the FHA. The bank believes the terms of that agreement were “clear and unambiguous.” It is asking the court for compensation for “injuries suffered as a result of the repetitive litigation,” according to the filing.