American International Group Inc posted a $61.7 billion quarterly loss, the biggest in corporate history, and reached a new government bailout deal after officials concluded the insurer was too big to be allowed to fail.

The new bailout avoids for now any crippling credit rating downgrades that could force AIG to come up with billions of dollars that it might not have.

Given the systemic risk AIG continues to pose and the fragility of markets today, the potential cost to the economy and the taxpayer of government inaction would be extremely high, the U.S. Treasury Department and the Federal Reserve said in a joint statement.

AIG, which operates in more than 130 countries, was once the world's largest insurer by market value. Its shares rose 9 cents to 51 cents in pre-market trading.

The quarterly loss, AIG's fifth in a row, equaled $22.95 per share, and compared with a year-earlier loss of $5.29 billion, or $2.08 per share. The latest quarterly loss equaled about $670.2 million per day, or $7,757 per second.

For all of 2008, AIG lost $99.29 billion, wiping out profit dating back to the early 1990s.

Major credit rating agencies left AIG's medium investment-grade ratings alone after news of the loss and the new rescue package.

Moody's Investors Service analyst Bruce Ballentine said he expected the government will provide incremental support as needed to ensure that AIG can meet its obligations through this period of severe economic recession and market turmoil.

The new bailout gives AIG more lenient terms on existing financing, and will give the government a preferred-share stake in two life insurance businesses.

AIG also announced plans to spin off part of its property-casualty business, to be renamed AIU Holdings.

The revamped rescue package is the third since last fall when the government stepped in to bail out AIG.

The Fed and the Treasury said AIG, which has counterparties around the globe, was so important to the U.S. economy and financial system that it needed more help.

This will take time and possibly further government support if markets do not stabilize and improve, they said in a statement.

(Reporting by Lilla Zuill and Jonathan Stempel; Additional reporting by Glenn Somerville in Washington, Editing by Ted Kerr)