American International Group Inc. said on Tuesday it completed the deal under which it is getting an $85 billion injection of taxpayer money, while the government gets an 80 percent stake in one of the world's largest insurers.

New York-based AIG said it signed a definitive agreement with the Federal Reserve Bank of New York for the deal that was hammered out last week.

The agreement provides a two-year $85 billion emergency loan at an interest rate of about 11.5 percent to AIG, which teetered on the edge of failure because of stresses caused by the collapse of the subprime mortgage market and the credit crunch that ensued.

In return, the government will get a 79.9 percent stake in AIG.

AIG said it will repay the money in full with proceeds from the sales of some of its assets. It will be up to the company to decide which assets to sell and the timing. The government does, however, have veto power.

Shortly after AIG struck the deal, it announced former Allstate Corp. Chief Executive Officer Edward Liddy was taking over as chairman and chief executive. Liddy replaced Robert Willumstad, who took over the company in June.

"AIG made an exhaustive effort to address its liquidity needs through private sector financing, but was unable to do so in the current environment," Liddy said in a statement Tuesday. "This facility was the company's best alternative. We are pleased to have finalized the terms of the facility, and are already developing a plan to sell assets, repay the facility and emerge as a smaller but profitable company."

He said AIG's insurance subsidiaries remain "strong, liquid and well-capitalized."