The U.S. government took equity in AIG and charged the insurance company 12 percent interest on its bailout “to minimize the windfall” of the firm’s shareholders, former Federal Reserve Chairman Ben Bernanke testified Thursday. Defending the deal, Bernanke said a bankrupt AIG would have been catastrophic for the U.S. economy.

The former fed chairman’s testimony came on the ninth day of a federal trial centering on whether the government unfairly treated AIG by taking 80 percent equity in the company and charging 12 percent interest on its loan. Maurice “Hank” Greenberg, the insurance company’s former CEO and its largest shareholder in 2008, is alleging that the government illegally took the 80 percent stake in AIG in exchange for the initial $85 bailout of the company. AIG became one of the symbols of the recession after nearly a quarter of a million dollars in bonuses were paid out despite billions in losses during the financial meltdown.

"Our goal was to minimize the windfall to AIG shareholders," Bernanke testified about the terms of the government bailout, according to USA Today. He said the interest imposed, which Greenberg claimed was unfairly higher than other financial firms that received a bailout, was “additional compensation to taxpayers for the risks they were taking.”

Greenberg’s lawyer, David Boies, is arguing that the terms of the government loan were disproportional to the risk it was taking. The government maintains that the bailout terms were fair, noting that AIG’s stock rose after the loan.

Earlier on Thursday, Bernanke agreed with Boies that an AIG bankruptcy would have been “catastrophic” for the financial system. “We were very concerned about that possibility, yes,” he said, according to Reuters.

Also on Thursday, former U.S. Treasury Secretary Tim Geithner, who was president of the New York Federal Reserve Bank at the time of the bailout, finished up his testimony from Wednesday. He testified that the government was within its rights to impose the terms of the bailout.

“The world was so fragile and the consequences of AIG’s failure were so great, that I was very confident we met that test,” Geithner said, according to the New York Times.

Bernanke is expected to continue his testimony on Friday.