The Treasury Department announced Thursday that the federal government has reached an agreement with American International Group to "accelerate" the bailed-out insurance giant's exit from government hands. 

The department announced that under the deal, AIG would repay taxpayers for the billions in government aid it has reaped since the height of the financial crisis. 

"The exit strategy announced today dramatically accelerates the timeline for AIG's repayment and puts taxpayers in a considerably stronger position to recoup our investment in the company," Treasury Secretary Tim Geithner said in a written statement. 

The plan announced Thursday could return a profit to taxpayers who footed the bill for AIG's near collapse in September 2008. The New York-based firm, one of the hardest-hit financial companies by the credit crisis, received the largest bailout from the federal government and became a target of taxpayer frustration over the financial sector's special treatment by Washington. 

It received a bailout package worth as much as $180 billion from the government, which received an 80 percent stake in the company in return. 

The insurance giant was not undone by its traditional business, but instead for dealing in the complex derivatives and securities market that got so many financial companies into trouble. AIG also received considerable criticism because it continued to pay out bonuses to employees after it received the bailout, including employees who worked in the division that nearly destroyed the company. 

As part of AIG's exit plan, the U.S. Treasury Department will swap preferred shares it currently holds in AIG for common stock and then sell those shares over time. AIG will also repay loans it received from the Federal Reserve Bank of New York as part of the deal. 

"This is a pivotal milestone as we deliver on our long-standing promise to repay taxpayers," Robert Benmosche, AIG's CEO said in a statement. "We are very pleased that this agreement vastly simplifies current government support of AIG." 

Geithner said the plan would help AIG "reposition itself as an independent, privately owned company over time." 

The government will receive about 1.66 billion shares of AIG common stock in exchange for the $49.1 billion in preferred shares it holds in AIG. Those preferred shares were issued through the government's Troubled Asset Relief Program, which was launched to provide $700 billion to financial companies during the credit crisis. 

The conversion price of the government's shares is equal to about $29.67 a share. 

AIG shares rose 80 cents, or 2.1 percent, to $38.25 in pre-opening trading. So if the government is able to sell shares at the current trading price, it will make $13.2 billion in profit. 

The government could still lose money elsewhere. As part of the bailout, the government took over some of AIG's risky investments, and is exposed to potential losses related to them. 

To alleviate concerns about the government flooding the market with new shares of AIG, the insurer will issue 75 million warrants to current common shareholders that will allow them to buy new stock for $45 per share. 

AIG owes the Federal Reserve Bank of New York about $20 billion. It plans to repay that debt, in part, through earnings it generates and the sale of some its subsidiaries. AIG has been selling some of its units since it received the initial bailout in September 2008. It is in the process of selling American Life Insurance Co. to MetLife Inc. and spinning off American International Assurance Co. into a new company. Those two moves will help cover a large portion of the money AIG owes the Federal Reserve bank of New York. 

The Associated Press contributed to this report.