The Treasury Department estimated Monday that its pending sale of shares in global insurance giant American International Group would put taxpayers in the black, four years after the government rescued the company in one of the largest, most-despised bailouts of the financial crisis.

The Treasury said in a release that it will sell more than 550 million of its shares to AIG and its investors for $32.50 per share, a deal that should net about $18 billion. Officials estimated that after the sale, the Treasury and the Federal Reserve will have netted $194.7 billion from its AIG investment, about $12 billion more than the government committed in aid.

The stock sale would leave Treasury with approximately 317 million shares in AIG — a 21.5 percent stake in the company, down from a high of 92 percent — and leave open the possibility for future additional profit as the government exits the company.

“Taking action to stabilize AIG during the financial crisis was something the government should never have had to do, but we had no better option at the time to protect the American economy from the damage that would have been caused by the company’s collapse,” Treasury Secretary Timothy F. Geithner said in a statement. “To stabilize and then restructure the company with a very substantial positive gain for the American taxpayer is a significant accomplishment, but we need to continue the critical task of implementing Wall Street reform so that the American economy is never put in this position again.”

In a separate statement, AIG chief executive Robert Benmosche said the pending sale marks a significant milestone.

“This offering, Treasury’s largest to date, makes America whole on its investments in AIG plus a profit,” Benmosche said. “We are close to achieving what most outside AIG thought unimaginable. The people of AIG never lost faith, kept working, and are grateful for being given the chance to make good on this goal.”

The government’s hasty, controversial bailout of AIG and its drawn-out, just-as-controversial exit from the company has resulted in an unlikely success story. Few people would have predicted during the depths of the financial crisis — or even during the national outrage that followed news of bonuses being awarded at AIG after the bailout — that taxpayers eventually would turn a profit on the rescue of a company whose risky derivatives trades nearly sank the global economy.

But that improbable outcome now seems probable. And an essentially nationalized company that seemed destined for failure is now a profitable, nearly-private enterprise once again, much smaller but with much less risk on its books.

“This is right on schedule,” said James Millstein, a former Treasury official who oversaw the AIG reorganization. “Pretty good, even for government work.”

AIG’s turnaround represents an accomplishment for the company and for the Obama administration and is a testament to how the nation’s financial markets have stabilized since the depths of the financial crisis in 2008.

But despite the recent good news, not everyone is ready to uncork the champagne.

“I think it’s a mixed story,” said Bill Black, an associate professor of economics and law at the University of Missouri at Kansas City and a former financial regulator.

On one hand, Black said, “had they simply allowed an unconstrained collapse of AIG, I think it’s true that it likely would have been a terrible decision with really severe consequences.”

But he and others insist that even a largely successful bailout comes with its own set of circumstances.

“It creates perverse incentives,” Black said. “There’s an enormous danger to providing bailouts to systemically dangerous institutions and, in particular, bailing out their creditors 100 cents on the dollar. That danger is that you create crony capitalism.”

In addition, Black said that while the government had done well in recouping taxpayer money, it had “missed an opportunity” to use its majority ownership of AIG to force the company to shrink even more than it did and to eliminate it as a systemic risk to the financial system.

Christy Romero, the special inspector general for the government’s bailout fund, the Troubled Assets Relief Program, shares concerns that the success of the AIG bailout could lead investors to expect the government to rescue other firms whose failure could threaten the economy and thereby does not adequately discourage excessively risky practices.

“There are significant issues of moral hazard,” Romero said. “The whole notion of the bailout is that these companies like AIG who did risky practices are insulated from the consequences. All of us, as taxpayers, had to put AIG on our shoulders.”

Despite the lessons of the crash, AIG still deals in complex derivatives, which fueled its meltdown, and has no single banking regulator watching over its non-insurance financial businesses, Romero’s office noted in a July report. “Effective, comprehensive, and rigorous regulation of AIG is vital to ensure that history does not repeat itself,” the report stated.

If officials eventually designate AIG as a “systemically important” financial firm, the Federal Reserve would become the company’s primary regulator, and AIG would find itself subject to stricter standards and oversight. So far, that has not happened.

“It’s not over. It still remains as one of the largest TARP investments,” Romero said. “I don’t think you can declare anything a success story — or a failure — when you’re still in the middle of it.”

Linus Wilson, a finance professor at the University of Louisiana at Lafayette, who has closely tracked the government’s bailouts, calculated that the taxpayer stake in AIG should drop to between 16 and 22 percent after the pending sale. In addition, he estimates that taxpayers could exit AIG by the end of the year with a profit of about $4.5 billion.

Wilson said he believes Treasury officials erred by not liquidating more of the government’s stock in AIG early on, when its stock price hovered around $40. It closed Monday at $33.30, up more than 38 percent on the year.

Despite the what-ifs, Wilson said the AIG investment is likely to return more taxpayer dollars than some other high-profile bailouts, namely automakers Chrysler and General Motors and mortgage-giants Fannie Mae and Freddie Mac.

“If the government breaks even on AIG,” he said, “that’s a lot better than expected.”