Eric Thayer/Reuters

The Treasury Department said on Tuesday that it had sold its remaining stake in the American International Group, earning about $7.6 billion from the sale.

The government sold the 234.2 million shares at $32.50 each, a small discount from the closing price of $33.36 on Monday. The block of shares represented a 15.9 percent stake in the insurer.

With the latest sale, taxpayers have gained about $22.7 billion from a bailout that many predicted would prompt a staggering loss. In an effort to stabilize the global banking system, the government rescued A.I.G. just days after the failure of Lehman Brothers.

The stock sale also means that A.I.G. is a fully private enterprise once more, after the government owned as much as 92 percent of its shares. After the sale, the Treasury Department will hold only warrants to buy about 2.7 million shares of A.I.G. common stock, which will also be sold to generate a profit.

“On behalf of the 62,000 employees of A.I.G., it is my honor and privilege to thank America for giving us the opportunity to keep our promise to make America whole on its investment in A.I.G. plus a substantial profit,” Robert H. Benmosche, the insurer’s chief executive, said in a statement. “Thank you America. Let’s bring on tomorrow.”

The A.I.G. offering was managed by Bank of America Merrill Lynch, Citigroup, Deutsche Bank, Goldman Sachs and JPMorgan Chase. The Treasury Department was advised by Greenhill & Company.