The settlement, announced Friday, covers 21 major institutional investors, including competitor Goldman Sachs, BlackRock Financial Management, and Metropolitan Life Insurance Co. The mortgage-backed securities were sold by JPMorgan — the biggest U.S. bank — and Bear Stearns between 2005 and 2008.

The deal is the latest in a series of legal settlements over JPMorgan’s sales of mortgage-backed securities in the years preceding the financial crisis. As the housing market collapsed between 2006 and 2008, millions of homeowners defaulted on high-risk mortgages. That led to billions of dollars in losses for investors who bought securities created from bundles of mortgages. Those securities were sold by JPMorgan and other big Wall Street banks.

New York-based JPMorgan has said that most of its mortgage-backed securities came from investment bank Bear Stearns and savings and loan Washington Mutual, troubled companies that JPMorgan acquired in 2008.

Separately, JPMorgan has been negotiating with the U.S. Justice Department to settle a civil inquiry into its sales of mortgage-backed securities. The bank reached a tentative deal last month to pay $13 billion, but the negotiations have hit a stumbling block.

As part of the $13 billion deal, $4 billion will resolve U.S. government claims that JPMorgan misled mortgage finance giants Fannie Mae and Freddie Mac about risky mortgage-backed securities. That part of the deal was announced on Oct. 25.

Fannie and Freddie were bailed out by the government during the crisis and are under federal control.

Still to be decided is whether the Justice Department will file criminal charges against JPMorgan in the mortgage securities debacle. An investigation is underway by the U.S. Attorney’s office in Sacramento, Calif.

Mounting legal costs pushed JPMorgan to a rare loss in this year’s third quarter, the first under CEO Jamie Dimon’s leadership. The bank reported Oct. 11 that it set aside $9.2 billion in the July-September quarter to cover the string of legal cases against the bank.

JPMorgan said it has placed a total of $23 billion in reserve to cover potential costs.

Goldman Sachs, Citigroup and other big banks have been accused by the Securities and Exchange Commission of deceiving investors in sales of mortgage securities in the run-up to the crisis. Together they have paid hundreds of millions in penalties to settle civil charges brought by the SEC.

JPMorgan settled SEC charges in June 2011 by agreeing to pay $153.6 million and reached another such agreement for $296.9 million last November. The banks in all the SEC cases were allowed to neither admit nor deny wrongdoing — a practice that brought criticism of the agency from judges and investor advocates.