Morgan Stanley agreed to give up insurance claims against MBIA Inc in exchange for a $1.1 billion payment from the ailing insurer, ending a two-year legal fight over guarantees on mortgage bonds.

The deal, announced on Tuesday, is the latest move by Morgan Stanley Chief Executive James Gorman to clear away vestiges of the financial crisis and put the Wall Street bank on a more stable path.

The settlement will cause Morgan Stanley to take a $1.2 billion charge in the fourth quarter after accounting for a tax benefit, but it will also remove risky assets from company's balance sheet that have led to big swings in its quarterly earnings over the past four years.

Additionally, the deal will shore up Morgan Stanley's capital levels under tougher rules that start coming into effect in 2013.

In a statement, Gorman said the settlement had been a top priority for Morgan Stanley this year, consistent with our efforts to build capital and de-risk the balance sheet.

The settlement stems from credit-default swaps (CDS) that Morgan Stanley had entered with MBIA several years ago to protect against losses on mortgage bonds.

MBIA, a bond insurer, historically focused on municipal bonds but as the U.S. real-estate market heated up last decade, it sold large numbers of CDS on mortgage-backed securities and other structured finance products.

MBIA's bets on CDS started souring as the financial crisis ramped up, leading the company to split itself into two parts: a municipal guarantee business and a structured finance unit. MBIA announced the restructuring in 2009 after receiving approval from state insurance regulators.

A group of 18 banks, including Morgan Stanley, objected to the restructuring in court, arguing that it might leave the insurer unable to pay out its structured finance obligations.

As part of the settlement, Morgan Stanley agreed to end its legal objections to MBIA's restructuring, and MBIA agreed to drop a lawsuit pertaining to the quality of the bonds underlying the CDS contracts.

MBIA will pay Morgan Stanley $1.1 billion to settle legal claims, a person familiar with the matter told Reuters.

The insurer's structured finance division, known as MBIA Insurance, will pay the settlement using a loan from its municipal bond division called National Finance, according to another person familiar with the deal.

All but five banks have settled with MBIA, including HSBC Holdings PLC , Royal Bank of Scotland PLC and Wells Fargo & Co . Those still pursuing claims include Bank of America Corp and UBS AG .

An MBIA spokesman confirmed that there was a settlement with Morgan Stanley, but declined to comment on the $1.1 billion settlement figure.

We are continuing to work toward resolving all the litigation, said Kevin Brown, a spokesman for MBIA. We're talking to most, but not all, the parties.

Robert Giuffra Jr, a partner at Sullivan & Cromwell and lead counsel for banks that are still suing MBIA, said the plaintiffs will continue to fight its restructuring.

Benjamin Lawsky, financial services superintendent for the state of New York, said his agency will continue to work with the remaining companies and MBIA to seek resolutions.

A WIN FOR BOTH SIDES

The Morgan Stanley-MBIA settlement will benefit both parties, investors said, though it may represent a bigger win for MBIA.

MBIA shares closed up 0.7 percent on Tuesday at $11.48, having hit $12.60 after the deal announcement. Morgan Stanley fell 1.4 percent to end the day at $15.17, but had risen as high as $16.55 earlier in the day.

The settlement will remove a big swing factor from Morgan Stanley's quarterly earnings results. Because the CDS contracts turned MBIA into a major counterparty of the bank, the widening or narrowing of its credit spreads resulted in big non-cash losses and gains.

Getting rid of MBIA exposure will free up $5 billion worth of capital for Morgan Stanley and improve its Tier 1 common capital ratio by 75 basis points under upcoming rules. Under existing rules, it will reduce Morgan Stanley's Tier 1 common ratio by 30 basis points.

Gorman has been on a mission to improve Morgan Stanley's balance sheet this year, in part to ease investor concerns about the bank's exposure to the European sovereign debt crisis.

In April, Gorman struck a deal with Mitsubishi UFJ Financial Group, a major investor and partner, to convert 7.8 million Morgan Stanley preferred shares into 385.5 million shares of common stock. That move lifted Morgan Stanley's capital ratios.

Gorman has also overseen the dismantling of risky trading operations to comply with a new financial reform rule, wound down other risky assets and implemented higher pricing for over-the-counter derivatives products to reflect higher risk and cost. He has also adjusted Morgan Stanley's funding model to reduce its exposure to riskier, short-term lending.

Still, its shares are down 43 percent so far this year, compared with a 32 percent decline for the NYSE Arca Securities Broker/Dealer Index.

Walter Todd, a portfolio manager at Greenwood Capital, said Gorman's efforts have been noticed but that concerns remain over Europe and the business model of large investment banks. Todd exited his firm's Morgan Stanley position last week to reduce volatility in the portfolio.

I think it's nice to get this behind them and check it off as something not to worry about anymore , but I wouldn't go out and buy the name because of this agreement, he said.

For MBIA's part, the deal removes a big hurdle standing in the way of its restructuring, at a lower cost than if Morgan Stanley had pursued its claims in full.

Morgan Stanley had $2.7 billion worth of net exposure to MBIA's derivative contracts as of September 30, according to a quarterly regulatory filing. The bank is writing off $1.8 billion worth of the underlying debt, which will lead to the $1.2 billion charge after taxes.

But Manal Mehta, a founding partner of the hedge fund Branch Hill Capital, which owns MBIA shares, estimates that the total notional amount of the underlying securities was more than $10 billion -- meaning that MBIA's $1.1 billion settlement may represent just 10 percent of the potential cost.

This is a fantastic deal for MBIA, said Mehta.

A Morgan Stanley spokesman declined to disclose the notional amount of underlying securities. Mehta extrapolated his estimate from disclosures by Bank of America.

(Reporting by Lauren Tara LaCapra in New York,; additional reporting by Karen Freifeld in New York; Editing by Lisa VonAhn, Dave Zimmerman, Dan Wilchins and Steve Orlofsky)

(This story was corrected in paragraph eight to say MBIA regulators allowed the company to split, rather than were forced to split the company)

??