OF ALL THE financial institutions that got government aid during the financial panic of 2008, none was less morally deserving than AIG. The insurance group imploded due to reckless bets it had made through what was essentially an in-house hedge fund. Nor were many bailouts bigger than the $182 billion combined commitment that the Federal Reserve and the Treasury Department made to AIG during the Bush and Obama administrations. Yet no bailout was more necessary, given the cascading disaster that AIG’s failure could have set off in the U.S. and European financial systems.

You hardly hear anything about the AIG bailout these days, in contrast to the debate that still rages over General Motors, Chrysler, Fannie Mae and Freddie Mac. Could it be that, all things considered, the AIG bailout is working pretty well? Actually, yes. The firm used $140 billion of the $182 billion available from the government, divided between Fed loans and Treasury equity purchases. The bulk of that has returned to the government, with interest.

This has occurred because, having spent the past two years selling excess assets and modernizing its core insurance businesses, AIG is profitable again. The firm’s only remaining debt to the Fed is a $9.3 billion loan, against which the central bank holds collateral valued at almost twice that. So it’s highly unlikely taxpayers will take a loss — and quite likely they’ll turn a profit.

The remaining federal commitment consists of the Treasury Department’s majority share of AIG stock. There’s good news on that front, too: On Wednesday, Treasury announced that it plans to sell $6 billion worth of its stake. Cleverly, Treasury sold about half of that amount back to AIG; this gave Treasury an alternative to merely dumping shares on the market and so boosted the price it could command on behalf of taxpayers. Wednesday’s sale reduced the taxpayers’ stake in AIG to $35.8 billion, at the current price of roughly $29 per share.

Treasury still has to shed more than a billion shares, or 70 percent of the company. The current bull market facilitated the latest sale; it can’t last forever. Still, Bernstein Research, a Wall Street firm, recently described AIG as “a recapitalized and de-risked firm, on a stable footing and pursuing a thoughtful renewal.” Since the government paid $28.50 each for its shares, all it needs to break even is for AIG’s stock price to stay about where it is now. Given the firm’s restructuring, that seems feasible.

There is much not to like about the AIG bailout, starting with the fact that it was also an indirect bailout of the firm’s counterparties, such as Goldman Sachs, Deutsche Bank and Societe Generale of France. As with the auto bailout and others, the AIG rescue will forever be subject to the criticism that it allowed businessmen to avoid paying the full price of their failures. As with other bailouts, the true cost-benefit analysis can never be known, since we’ll never know exactly how big a catastrophe it averted.

On balance, though, the risk of disaster was sufficiently high, compared to the – so far — modest costs, that the AIG rescue deserves to be labeled, if not a success, then certainly a gamble worth taking.