The U.S. government ended up losing $10.5 billion on the General Motors bailout, but it says the alternative would have been far worse.
The Treasury Department sold its final shares of the Detroit auto giant on Monday, recovering $39 billion of the $49.5 billion it spent to save the dying automaker at the height of the financial crisis five years ago.
related investing news
Without the bailout, the country would have lost more than 1 million jobs, and the economy could have slipped from recession into a depression, Treasury Secretary Jacob Lew said on a conference call with reporters.
"The economic stakes were high, and President Obama understood that inaction was not an option," Lew said. "His decision to commit additional support to GM while requiring them to fundamentally restructure their business was tough but it was right."
The government received 912 million GM shares, or a 60.8 percent stake, in exchange for the bailout in 2008 and 2009. It began selling shares once GM went public again in November of 2010, and the pace picked up this year as the stock rose more than 40 percent.
Last month, the government said it expected to sell the remaining 2 percent stake by the end of the year.
(Read more: Kyle Bass takes stake in 'undervalued' GM)
GM shares rose 73 cents, or 1.8 percent in after-hours trading following the announcement. They rose 1.8 percent in regular trading, at one point reaching $41.17, the highest level since GM's 2010 initial public offering.
(What's the stock doing now? Click here).
Earlier Monday, Mark Reuss, GM's North American president, told reporters in Warren, Mich., that a government exit would boost sales, especially among pickup truck buyers.
GM has said repeatedly that some potential customers have stayed away from its brands because they object to the government intervening in a private company's finances. Because of the bailout, GM had been tagged with the derisive nickname "Government Motors."
During the conference call, treasury officials shrugged off a question about whether GM should have been required to pay more because it has a large cash stockpile, saying that the bulk of the bailout money was converted to GM stock.
(Read more: Auto sales drop, buyers take on record loans)
Not doing the bailout would have cost the government more than it lost in missed tax revenue and payments for unemployment benefits and pensions, the officials said.
The company now is sitting on $26.8 billion in cash and is considering restoration of a dividend.
GM went through bankruptcy protection in 2009 and was cleansed of most of its huge debt, while stockholders lost their investments. Since leaving bankruptcy, GM has been profitable for 15 straight quarters, racking up almost $20 billion in net income on strong new products and rising sales in North America and China.
It also has invested $8.8 billion in U.S. facilities and has added about 3,000 workers, bringing U.S. employment to 80,000.
(Watch: GM to issue dividend quickly: LeBeau)
The auto bailout was part of the Troubled Asset Relief Program, with the bulk of the money going to financial institutions. Treasury said it spent $421.8 billion on bailouts and so far has recovered $432.7 billion including the loss on GM.
The Center for Automotive Research, an Ann Arbor, Mich., think tank, issued an updated report on Monday saying that if the government hadn't intervened and GM went out of business, nearly 1.9 million jobs would have been lost in 2009 and 2010.
Federal and state governments also would have lost $39.4 billion in tax revenue and payments made for unemployment benefits and food stamps, the study said.
—By The Associated Press