J. Scott Applewhite/Associated Press

When an outside analysis uncovered serious flaws with thousands of home loans, JPMorgan Chase executives found an easy fix.

Rather than disclosing the full extent of problems like fraudulent home appraisals and overextended borrowers, the bank adjusted the critical reviews, according to documents filed early Tuesday in federal court in Manhattan. As a result, the mortgages, which JPMorgan bundled into complex securities, appeared healthier, making the deals more appealing to investors.

The trove of internal e-mails and employee interviews, filed as part of a lawsuit by one of the investors in the securities, offers a fresh glimpse into Wall Street’s mortgage machine, which churned out billions of dollars of securities that later imploded. The documents reveal that JPMorgan, as well as two firms the bank acquired during the credit crisis, Washington Mutual and Bear Stearns, flouted quality controls and ignored problems, sometimes hiding them entirely, in a quest for profit.

The lawsuit, which was filed by Dexia, a Belgian-French bank, is being closely watched on Wall Street. After suffering significant losses, Dexia sued JPMorgan and its affiliates in 2012, claiming it had been duped into buying $1.6 billion of troubled mortgage-backed securities. The latest documents could provide a window into a $200 billion case that looms over the entire industry. In that lawsuit, the Federal Housing Finance Agency, which oversees Fannie Mae and Freddie Mac, has accused 17 banks of selling dubious mortgage securities to the two housing giants. At least 20 of the securities are also highlighted in the Dexia case, according to an analysis of court records.

In court filings, JPMorgan has strongly denied wrongdoing and is contesting both cases in federal court. The bank declined to comment.

Dexia’s lawsuit is part of a broad assault on Wall Street for its role in the 2008 financial crisis, as prosecutors, regulators and private investors take aim at mortgage-related securities. New York’s attorney general, Eric T. Schneiderman, sued JPMorgan last year over investments created by Bear Stearns between 2005 and 2007.

Jamie Dimon, JPMorgan’s chief executive, has criticized prosecutors for attacking JPMorgan because of what Bear Stearns did. Speaking at the Council on Foreign Relations in October, Mr. Dimon said the bank did the federal government “a favor” by rescuing the flailing firm in 2008.

The legal onslaught has been costly. In November, JPMorgan, the nation’s largest bank, agreed to pay $296.9 million to settle claims by the Securities and Exchange Commission that Bear Stearns had misled mortgage investors by hiding some delinquent loans. JPMorgan did not admit or deny wrongdoing.

“The true price tag for the ongoing costs of the litigation is terrifying,” said Christopher Whalen, managing director at Carrington Investment Services.

The Dexia lawsuit centers on complex securities created by JPMorgan, Bear Stearns and Washington Mutual during the housing boom. As profits soared, the Wall Street firms scrambled to pump out more investments, even as questions emerged about their quality.

With a seemingly insatiable appetite, JPMorgan scooped up mortgages from lenders with troubled records, according to the court documents. In an internal “due diligence scorecard,” JPMorgan ranked large mortgage originators, assigning Washington Mutual and American Home Mortgage the lowest grade of “poor” for their documentation, the court filings show.

The loans were quickly sold to investors. Describing the investment assembly line, an executive at Bear Stearns told employees “we are a moving company not a storage company,” according to the court documents.

As they raced to produce mortgage-backed securities, Washington Mutual and Bear Stearns also scaled back their quality controls, the documents indicate.

In an initiative called Project Scarlett, Washington Mutual slashed its due diligence staff by 25 percent as part of an effort to bolster profit. Such steps “tore the heart out” of quality controls, according to a November 2007 e-mail from a Washington Mutual executive. Executives who pushed back endured “harassment” when they tried to “keep our discipline and controls in place,” the e-mail said.

Even when flaws were flagged, JPMorgan and the other firms sometimes overlooked the warnings.

JPMorgan routinely hired Clayton Holdings and other third-party firms to examine home loans before they were packed into investments. Combing through the mortgages, the firms searched for problems like borrowers who had vastly overstated their incomes or appraisals that inflated property values.

According to the court documents, an analysis for JPMorgan in September 2006 found that “nearly half of the sample pool” — or 214 loans — were “defective,” meaning they did not meet the underwriting standards. The borrowers’ incomes, the firms found, were dangerously low relative to the size of their mortgages. Another troubling report in 2006 discovered that thousands of borrowers had already fallen behind on their payments.

But JPMorgan at times dismissed the critical assessments or altered them, the documents show. Certain JPMorgan employees, including the bankers who assembled the mortgages and the due diligence managers, had the power to ignore or veto bad reviews.

In some instances, JPMorgan executives reduced the number of loans considered delinquent, the documents show. In others, the executives altered the assessments so that a smaller number of loans were considered “defective.”

In a 2007 e-mail, titled “Banking overrides,” a JPMorgan due diligence manager asks a banker: “How do you want to handle these loans?” At times, they whitewashed the findings, the documents indicate. In 2006, for example, a review of mortgages found that at least 1,154 loans were more than 30 days delinquent. The offering documents sent to investors showed only 25 loans as delinquent.

A person familiar with the bank’s portfolios said JPMorgan had reviewed the loans separately and determined that the number of delinquent loans was far less than the outside analysis had found.

At Bear Stearns and Washington Mutual, employees also had the power to sanitize bad assessments. Employees at Bear Stearns were told that they were responsible for “purging all of the older reports” that showed flaws, “leaving only the final reports,” according to the court documents.

Such actions were designed to bolster profit. In a deposition, a Washington Mutual employee said revealing loan defects would undermine the lucrative business, and that the bank would suffer “a couple-point hit in price.”

Ratings agencies also did not necessarily get a complete picture of the investments, according to the court filings. An assessment of the loans in one security revealed that 24 percent of the sample was “materially defective,” the filings show. After exercising override power, a JPMorgan employee sent a report in May 2006 to a ratings agency that showed only 5.3 percent of the mortgages were defective.

Such investments eventually collapsed, spreading losses across the financial system.

Dexia, which has been bailed out twice since the financial crisis, lost $774 million on mortgage-backed securities, according to court records.

Mr. Schneiderman, the New York attorney general, said that overall losses from flawed mortgage-backed securities from 2005 and 2007 were $22.5 billion.

In a statement shortly after he sued JPMorgan Chase, Mr. Schneiderman said the lawsuit was a template “for future actions against issuers of residential mortgage-backed securities that defrauded investors and cost millions of Americans their homes.”