Morgan Stanley said on Thursday it agreed to pay the U.S. Treasury $950 million to redeem warrants to buy its stock, freeing it from the government's bank bailout program.

Morgan Stanley in June paid back $10 billion that it had borrowed from the U.S. Treasury's Troubled Asset Relief Program, known as TARP. Companies were eager to leave the program to escape potential rules restricting executive pay.

Morgan Stanley CEO John Mack said in a statement that his company appreciated the critical role the government played in stabilizing the banking industry and financial markets at a moment of unprecedented crisis.

The Wall Street firm said including dividends, it has now paid the government $1.26 billion, a 20 percent annualized return on its investment last fall.

(Reporting by Steve Eder, editing by Gerald E. McCormick)