WASHINGTON – A Goldman Sachs executive told an inquiry panel Thursday that the firm had no regrets about collecting billions of dollars in taxpayer money for correctly predicting the demise of the U.S. housing market.

David Viniar, Goldman’s chief financial officer, said the government had an obligation to honor American International Group’s full debts. The firm was entitled to be paid $12.9 billion out of the $182 billion bailout that went to crippled insurance giant AIG — the largest federal rescue.

“The government stepped into AIG’s shoes” and therefore had to honor its contract with Goldman, Viniar told the congressionally appointed panel investigating the financial meltdown.

Members of the Financial Crisis Inquiry Commission couldn’t understand how Goldman could take the full amount owed by AIG, knowing that U.S. taxpayers were picking up the tab at the onset of the worst recession since the 1930s.

“You were 100 percent recompensed on that deal, and the only people who were out money were the American public,” said Brooksley Born, a panel member.

The panel probed Goldman’s actions during a second day of hearings examining the firm’s relationship with AIG, and how their derivatives trading helped push the country into financial crisis.

AIG sold billions of dollars of credit default swaps, guarantees on mortgage securities that ended up forcing the company to pay out billions after the subprime mortgage bubble burst in 2007.

Goldman Sachs Group Inc. profited from its bets against the housing market before the crisis. The firm continued to reap huge profits after accepting federal bailout money and other government subsidies.