People walk inside JP Morgan headquarters in New York, October 25, 2013.

JPMorgan Chase & Co said on Friday it agreed to pay $4.5 billion to settle claims by investors who lost money on mortgage-backed securities before the collapse of the U.S. housing market.

The bank reached the agreement with 21 institutional investors in 330 residential mortgage-backed securities trusts issued by JPMorgan and Bear Stearns, which it took over during the financial crisis, according to the bank and lawyers for the investors.

The deal still has to be accepted by seven trustees overseeing the securities holdings, the parties said.

The settlement does not include trusts issued by Washington Mutual, which JPMorgan also acquired.

The deal is separate from the preliminary $13 billion settlement JPMorgan has reached with the U.S. government that would resolve a raft of actions over residential mortgage-backed securities.

"This settlement is another important step in J.P. Morgan's efforts to resolve legacy related RMBS matters," the bank said in a statement.

The bank said it believes reserves it has built will cover the expense of "this and any remaining" mortgage securities litigation.

Under the agreement, the trustees have until January 15 to accept the offer, which may be extended for another 60 days, according to JPMorgan and Gibbs & Bruns, the Houston law firm that represented the institutional investors.

Kathy Patrick of Gibbs & Bruns called the deal "an important milestone" in a three-year effort by the group of 21 bondholders.

The seven trustees over the bonds include Bank of New York Mellon Corp. Kevin Heine, a spokesman for the Bank of New York Mellon, said the bank would "evaluate the proposed settlement along with the other trustees."

If accepted, the deal would resolve claims that JPMorgan and Bear Stearns misrepresented the mortgages underlying the securities, JPMorgan said.

The settlement also would resolve servicing claims on all trusts issued by the bank and Bear Stearns between 2005 and 2008.

JPMorgan is the third bank to strike a deal with investors over shoddy mortgage-backed securities issued in the run-up to the financial crisis.

Bank of America Corp agreed to a $8.5 billion settlement in June 2011 with 22 institutional investors. That deal is still awaiting court approval.

In 2012, bondholders in trusts issued by Ally Financial's bankrupt former mortgage lending arm, Residential Capital, won an agreement to bring an $8.7 billion claim, although that was later reduced to $7.3 billion.

Gibbs & Bruns has represented investors in all three settlements. In 2011, the law firm said its investor clients had instructed trustees overseeing $95 billion of securities issued by JPMorgan, Bear Stearns and Washington Mutual to investigate whether the bonds were backed by ineligible mortgages.

Washington Mutual is not included in the deal because of litigation between the Federal Deposit Insurance Corp and JPMorgan over who is responsible for losses at the former mortgage lender, according to a person familiar with the matter.

The exclusion explains the difference between the amount of the announced deal and reports last month that JPMorgan was near an agreement with the investors for close to $6 billion, said another person familiar with the negotiations.

The separate tentative $13 billion settlement between JPMorgan and the U.S. government also has been complicated by that dispute, according to other sources.

JPMorgan CEO Jamie Dimon has vowed to resolve legal and regulatory issues that have been weighing heavily on the company since May 2012.

In October, JPMorgan reported its first quarterly loss under Dimon as it recorded more than $9 billion of expenses to build its litigation reserves.