NEW YORK (AP) -- Bank of America and its Countrywide unit will pay $8.5 billion to settle claims that the lenders sold poor-quality mortgage-backed securities that went sour when the housing market collapsed.The deal, announced Wednesday, comes after a group of 22 investors demanded that the Charlotte, N.C. bank repurchase $47 billion in mortgages that its Countrywide unit sold to them in the form of bonds.The group, which includes the Federal Reserve Bank of New York, Pimco Investment Management, and Blackrock Financial Management, argued that Countrywide enriched itself at the expense of investors by continuing to service bad loans while running up servicing fees.Bank of America, which bought Countrywide in 2008 for $4 billion, has denied those claims.Bank of America CEO Brian Moynihan said Wednesday that the settlement would minimize "future economic uncertainty" in the banking business and "clean up the mortgage issues largely stemming from our purchase of Countrywide."For several months, Bank of America battled claims based on estimates "that were much different from ours," Moynihan said. But at this point, it made more sense to settle than to keep fighting, he said."We have said consistently if people are reasonable and can get to a reasonable assessment of their claims and it's in the best interest of shareholders, we will settle," Moynihan told Wall Street analysts in a conference call.The settlement is subject to court approval and covers 530 trusts with original principal balance of $424 billion.Citi analyst Keith Horowitz said the settlement, which amounts to only 2 percent of the original principal balance, removes one of the largest investor risks for Bank of America."We think this could prove to be a step forward" for Bank of America, Horowitz said. It would show investors that the bank can manage through crisis without raising additional capital.As a result of the settlement, Bank of America put its second-quarter loss at $8.6 billion to $9.1 billion. Excluding the settlement and other charges, the bank expects to post a quarterly loss of $3.2 billion to $3.7 billion.Shares of Bank of America Corp. jumped more than 4 percent, or 48 cents to $11.30 before the market opened, with investors happy that the bank can put very big uncertainty behind it.Investors may now be more confident that they can get similar concessions from other major U.S. banks that created markets for mortgage-backed securities with questionable pedigrees.Yet stocks in the financial sector were rising in electronic trading Wednesday, likely because the Bank of America deal presents a framework for others to follow.