Financial kings Morgan Stanley (NYSE: MS) and Citigroup (NYSE: C) have come to an agreement in the fight over their wealth management joint venture.

Morgan Stanley has agreed to purchase Citigroup’s entire stake of Morgan Stanley Smith Barney (MSSB) at a price of $13.5 billion, 40% less than Citigroup’s $22 billion valuation estimate in July. Morgan Stanley will purchase 14% of the joint venture now, while buying the rest of Citi’s 35% stake over three years.

Shares of both financial institutions recorded gains on Tuesday’s morning session, with Citi up more than 2% and Morgan Stanley climbing 1.6%.

Morgan Stanley originally pegged the valuation of the business at $9.5 billion, but today’s decision leaned far more in its favor than Citi’s. Citigroup CEO Vikram Pandit has engaged in focusing his company on its core business, divesting non-core assets such as MSSB in an attempt to improve its capital position.

Morgan Stanley will need to improve MSSB’s profit margin, as the venture has caused headaches for the firm. CEO James Gorman projected a 20% pre-tax profit margin for MSSB in 2010 to investors, a goal that has shrunk down to 15% for 2013. MSSB has stumbled through the loss of more than 50 experienced advisors because of the struggles, with advisor Edward Moldaver, who managed $1.35 billion in assets, fleeing to Barclays.