By Glenn Somerville

WASHINGTON (Reuters) - The U.S. economy is struggling against "headwinds" that mean the government must retain the ability to respond to unexpected crises, even as it starts to wind down emergency programs, Treasury Secretary Timothy Geithner said on Thursday.

Testifying before a congressional panel that oversees the Troubled Asset Relief Program, or TARP, Geithner took credit for having averted a complete financial meltdown but warned against becoming too optimistic about a rebound.

"The financial and economic recovery still faces significant headwinds," he said, citing high unemployment and home foreclosure rates, tight credit and impaired securitization markets, especially for mortgage-backed securities.

Geithner laid out a strategy for winding down the bank bailout program but also defended his decision on Wednesday to extend it past a scheduled year-end expiry, until next October 3, as a necessary guard against a sudden economic relapse.

"History suggests that exiting too soon from policies designed to contain a financial crisis can significantly prolong an economic downturn," he said.

TARP was approved by Congress last year as a $700-billion program to buy toxic or impaired assets from banks but was immediately converted into a fund for Treasury to make capital injections into ailing banks.

A Republican critic of TARP, Texas Rep. Jeb Hensarling who wanted it to expire on December 31, resigned from the five-member oversight panel. He has called the bailout effort a failure because lending remains constrained.

Big banks now are eager to exit TARP by repaying their bailout money, partly to free themselves from pay restrictions.

Bank of America <BAC.M> sent Treasury a $45-billion check on Wednesday to do so. Citicorp <C.N> also is talking to Treasury about repaying.

Geithner said it was "a good thing for the country that banks are eager to get out" of TARP but it has to be done with care. "We are not prepared to have this money come back in a way that would leave the system or these institutions without adequate capital to face their challenges ahead."

Citigroup got $45 billion of TARP money last year.

Geithner said the TARP investments made in banks were returning more money sooner than thought and the next few weeks will bring "substantial income" from more sales of warrants to buy stock in banks that are repaying bailout money.

Geithner said he was extending TARP, on a modified basis, through next October because he didn't want a repeat of the situation in which the government potentially faces a crisis without having adequate tools on hand to deal with it.