The mortgage lender Countrywide Financial Corp., absorbed by Bank of America Corp. in 2008, has agreed to pay $500 million to resolve class claims that it misled mortgage-backed securities investors. The record deal brings an end to a long legal battle that didn’t unfold quite as plaintiffs lawyers had hoped.

The settlement, announced on April 17 by plaintiffs counsel at Cohen Milstein Sellers & Toll; Robbins Geller Rudman & Dowd; and Kessler Topaz Meltzer & Check, resolves three related investor class actions brought against Countrywide in the wake of the financial crisis. If the deal is approved by U.S. District Judge Mariana Pfaelzer in Los Angeles, it will be the largest settlement yet in a securities class action brought by mortgage-backed securities investors, eclipsing a $315 million deal BofA subsidiary Merrill Lynch reached in December 2011.