The U.S. Treasury announced Thursday night that it has reached an agreement to fully withdraw from its ownership stake and other investments in Chrysler and that it will recapture most of the $12.5 billion it has put into the automaker’s rescue.

The United States will sell its 6 percent equity stake in the company to the Italian automaker Fiat, which already has a stake in the company and whose chief, Sergio Marchionne, now runs Chrysler. The transaction is expected to allow Fiat to take a majority stake in the fabled U.S. brand.

With that sale and other related transactions, the United States will have recovered $11.2 billion, or about 90 percent of the rescue money it plowed into the company during the depths of the recession.

The Obama administration has justified the rescues of General Motors and Chrysler — despite any anticipated losses — by noting that saving the automakers potentially saved hundreds of thousands of jobs at the companies and their vast network of suppliers.

“As Treasury exits its investment in Chrysler, it’s clear that President Obama’s decision to stand behind and restructure this company was the right one,” Treasury Secretary Timothy F. Geithner said in a statement. “Today, America’s automakers are mounting one of the most improbable turnarounds in recent history – creating new jobs and making new investments in communities across our country.”

Although the Treasury still has the right to recover proceeds from old Chrysler assets left in the bankruptcy, the United States is unlikely to fully recover the $1.3 billion difference between the $12.5 billion it invested and the $11.2 billion it has recovered, the Treasury said in a statement.

In a statement, Fiat Chairman John Elkann praised Marchionne and his team for making “it possible to repay the trust that the U.S. government demonstrated towards us a mere 23 months ago.”

The exit of the United States represents a remarkable turnaround for a company that some in the Obama administration thought should have been left for dead during the recession. The automaker was hemorrhaging millions of dollars and had virtually no new cars ready for sale.

Last month, Chrysler reported its first quarterly profit since the recession.