Shares of Bank of America (BAC -1.07%) and mortgage-bond insurer MBIA (MBI -3.80%) are exploding higher in afternoon trading after the companies said they will settle their ongoing legal battle over souring Countrywide-issued mortgage-backed securities insured by MBIA in the lead up to the financial crisis.

According to The Wall Street Journal, Bank of America will pay MBIA $1.7 billion to end the particularly antagonistic dispute.

The performance of both companies' shares shows the relief investors are feeling upon hearing the news. For MBIA, it could even mean survival. The ailing insurance company has been on the brink of seizure from regulators since suffering massive losses related to MBSes that it insured prior to 2008. In its most recent 10-K, it bluntly noted that its ability to "meet liquidity requirements" within the requisite time frame was directly conditioned upon the outcome of this case and others like it.

And for Bank of America, the news resolves a number of potentially thorny issues. In the first case, the $1.7 billion payment is roughly half of that demanded by MBIA in its lawsuit. In the second case, the agreement marks yet one more critical step for the bank as it attempts to atone for the sins of mortgage originator Countrywide, which it lamentably acquired in 2008. And finally, it puts to rest concerns that certain legal rulings in the MBIA case, which had recently gone against the bank, could negatively impact other cases, and thereby expose Bank of America to further untold billions of dollars in liability.

Make no mistake about it, assuming the deal is fully and finally consummated, this is a huge step forward for both MBIA and Bank of America. The suit was one of the earliest filed after the financial crisis and is now one of the last remaining to be settled.