U.S. Federal Reserve Chairman Ben Bernanke on Tuesday defended the government's latest bailout of insurer AIG, telling irate lawmakers that he, too, was angry, but that failure to act could have triggered an economic disaster.

Bernanke, in testimony to the Senate Budget Committee, also gave a grim view of economic prospects, saying labor market conditions may have worsened in recent weeks. His comments helped drive the stock market briefly lower.

Pressed by the Senate committee to justify the latest in an expanding series of bailouts for American International Group, Bernanke said there was no alternative, even though the company had been irresponsible.

We know that failure of major financial firms in a financial crisis can be disastrous for the economy. We really had no choice, he told the panel.

The U.S. government threw a fresh $30 billion lifeline to AIG on Monday, as part of a restructured bailout that had earlier swelled to about $150 billion. AIG, which reported a record $61.7 billion quarterly loss on Monday, has been slammed by losses on its credit default swaps that guarantee mortgage-linked securities.

Bernanke said AIG's extensive relationships with banks around the globe presented the risk of contagion should the company fail, and said authorities were working hard to try to neutralize dangerous positions.

We have been doing what we can to break the company up, to get it into a salable position and to try to defang it, he said. If there's a single episode in this entire 18 months that has made me more angry, I can't think of one (other than) AIG, he added, equating the company's financial services division with an unregulated hedge fund.

INCREASE IN BUDGET GAP A NECESSARY EVIL

Bernanke told the committee that restoring stability to the battered financial sector was a prerequisite to a recovery from the deep U.S. recession, and said a surge in U.S. government debt was unavoidable.

We are better off moving aggressively today to solve our economic problems, he said. The alternative could be a prolonged episode of economic stagnation that would not only contribute to further deterioration in the fiscal situation, but would also imply lower output, employment and incomes for an extended period.

In addition to the likelihood of a worsening jobs market, Bernanke said many businesses are burdened with excess inventories and are likely to cut production further in the months ahead.

The blue chip Dow Jones industrial average, which closed below 7,000 for the first time in 12 years on Monday, fell about 40 points following Bernanke's comments before rebounding as U.S. President Barack Obama spoke separately.

The collapse of the U.S. housing market bubble has set off a chain reaction tipping economies around the world into recession, and heaping fiscal strain on governments.

A budget proposal released by the White House last week envisioned a record budget deficit of $1.8 trillion this year, and a rise in the ratio of debt to gross domestic product to about 60 percent from 40 percent, the highest level since the early 1950s.

All else equal, this is a development that all of us would have preferred to avoid, Bernanke said.

He said a decision on whether the government needs to increase the size of a $700 billion bank rescue package would depend on bank stress tests being conducted by regulators and the direction of the economy.

The president's budget plan included a $750 billion placeholder to take into account the possibility the administration could go back to Congress for more money to clean up the banking sector.

(Editing by Leslie Adler)