JPMorgan announced a $4.5 billion settlement Friday with institutional investors who suffered losses on mortgage securities purchased from the bank in the run-up to the financial crisis.

The deal resolves one of JPMorgan's many legal headaches in connection with securities tied to risky mortgages it allegedly sold while misrepresenting their quality. The bank called it "another important step" in addressing these issues.

The settlement still requires approval from a court and from the trustees who managed the mortgage pools. The payment would be allocated by a financial expert chosen by the trustees.

The deal relates only to JPMorgan (JPM) and Bear Stearns, and does not include securities associated with Washington Mutual. JPMorgan acquired ailing Bear and WaMu during the financial turmoil of 2008.

Mortgage-backed securities and related derivatives were a key cause of the financial crisis, saddling financial institutions with huge losses as the housing market cratered.

Related: Probe targets JPMorgan hiring in China

The group of 21 investors includes BlackRock, PIMCO and government-backed housing finance firms Fannie Mae and Freddie Mac.

Fannie and Freddie were involved in a separate agreement with JPMorgan over crisis-era mortgage securities last month in which the bank agreed to pay $5.1 billion.

The Justice Department is also in talks with JPMorgan over a potential multi-billion-dollar settlement on the same issue.

JPMorgan said it believed it had set aside sufficient reserves to pay for Friday's settlement and any additional litigation over mortgage-backed securities.

It's been a busy year for JPMorgan's legal department.

The firm has paid over $1 billion in fines in connection with last year's "London Whale" trading debacle, and $80 million more over allegedly unfair credit-card-billing practices.

In July, the bank agreed to pay $410 million to settle charges that it manipulated electricity prices in California and the Midwest. It is also facing scrutiny over its hiring practices in China and its alleged involvement in the Libor rate-fixing scandal.

JPMorgan posted a loss for the third quarter based on its massive legal expenses. CEO Jamie Dimon called the loss "painful" and warned that litigation costs could continue to be a drag on earnings at the nation's largest bank for several quarters.