Regions Financial Corp said on Wednesday it is selling Morgan Keegan to Raymond James Financial Inc for $930 million in stock, concluding a drawn-out auction of the brokerage firm.

The Birmingham, Alabama-based regional bank will also receive a $250 million dividend before the closing, pending regulatory approval. The deal is expected to close in the first quarter.

Regions has been trying to sell Morgan Keegan since the summer in a move that could help it repay $3.5 billion it owes the U.S. government in bailout aid. The auction of Morgan Keegan, based in Memphis, Tennessee, has seen a series of twists and turns, as both rivals and private equity firms jockeyed for the business.