NEW YORK (Reuters) - American International Group Inc posted a $61.7 billion fourth-quarter loss -- the biggest quarterly loss in corporate history -- after reaching a revised rescue deal with the U.S. government that wards off for now the prospect of crippling credit rating downgrades.

The massive quarterly loss, equal to $22.95 a share, was AIG’s fifth in a row, bringing the total loss over that period to more than $100 billion.

The U.S. Treasury and Federal Reserve said AIG had posed a systemic risk requiring government action to prevent its problems from damaging the entire financial system.

AIG, the recipient of $150 billion in taxpayer aid last year, will get access to an additional $30 billion under the government’s revised plan announced on Monday.

It also got more lenient terms on existing financing and will be able to significantly pay down an outstanding credit facility in a swap that 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, once the world’s biggest insurer by market value.

The Treasury and the Fed said that AIG, which has counterparties around the globe, was so important to the U.S. economy and financial system that it had to be helped, and they held out the possibility more aid might be needed.

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