Bank of America and insurer MBIA on Monday announced a $1.7 billion settlement deal resolving their dispute over mortgage securities that soured as the housing market collapsed. Bank of America will pay $1.6 billion in cash to MBIA and $137 million in the outstanding MBIA notes it held. Under the settlement terms, the Charlotte, North Carolina-based bank will end all of the remaining credit default swap (CDS) protection agreements it had purchased from MBIA on commercial mortgage-backed securities. In addition, the bank will provide a $500 million credit facility to MBIA Insurance Corp., a unit of the Armonk, New York-based company. MBIA will give Bank of America warrants to purchase 9.94 million shares to take a roughly 4.9 percent stake in the insurer, at $9.59 per share. The settlement requires certain approvals of the New York State Department of Financial Services. Once completed, the settlement will dismiss the litigation that began in September 2008 against Countrywide Home Loans and others, and later amended to include claims against Bank of America. In 2008, Bank of America bought Countrywide, which was, at the height of the US home-buying boom in the 2000s, the largest mortgage origination company in the United States. MBIA contended that the subprime mortgage giant had misled it into buying the risky debt that soured as home prices collapsed. \"We are very pleased to have reached a comprehensive settlement agreement with Bank of America that improves the outlook for MBIA Insurance Corp.,\" Jay Brown, MBIA chief executive, said in a statement. Brown said the deal set the stage for the company\'s unit National Public Finance Guarantee Corporation \"to reclaim its leadership position in the US public finance insurance market.\" Bank of America gained 5.2 percent; MBIA soared 45.4 percent. Bank of America said it would take $1.6 billion in additional pre-tax charges in the first quarter, which will reduce net income in the quarter to $1.5 billion, from the $2.6 billion reported in April. Bank of America\'s legal woes deepened earlier in the day as New York state announced plans to sue the bank and rival Wells Fargo for violating a 2012 settlement aimed at addressing widespread mortgage lending abuses. New York Attorney General Eric Schneiderman said the two banks had \"repeatedly\" flouted the terms of the $25 billion March 2012 settlement that makes it easier for homeowners to seek loan modifications.