Federal Reserve Chairman Ben Bernanke told Congress Wednesday that troubled mortgage giants Fannie Mae and Freddie Mac are in "no danger of failing."

The Fed chief made his remarks to the House Financial Services Committee, his second day on Capitol Hill where he briefed lawmakers on the problems plaguing the economy.

Bernanke appeared amid a backdrop of fading confidence in the U.S. financial system and in the national economy.

Get Breaking News Delivered to Your Inbox

The Fed and the Treasury Department on Sunday came to the rescue of mortgage giants Fannie Mae and Freddie Mac, offering to throw them a financial lifeline.

The two companies hold or guarantee more than $5 trillion in mortgages - almost half of the nation's total- and are major sources of financing for the mortgage market. The Bush administration is asking Congress to temporarily increase lines of credit to Fannie and Freddie and to let the government buy their stock. The Fed has offered to let the companies draw emergency loans.

The pledges of aid have raised concerns on Capitol Hill and elsewhere about the government's role in intervening to ease such financial troubles and the risk posed to taxpayers.

The two mortgage giants are "adequately capitalized," Bernanke said. However, "weakness of market confidence is having an effect" on the companies, making it difficult for them to raise capital.

The companies' shares have plunged as losses from their mortgage holdings threatened their financial survival.

The government's rescue plan was intended to send a signal to nervous investors worldwide that the government is prepared to take all necessary steps to prevent the credit market troubles that started last year from engulfing financial markets and further weakening the economy and housing markets.

"We will work our way through these financial storms," Bernanke said.

Treasury Secretary Henry Paulson told Congress on Tuesday that he hoped this lifeline won't need to be used. He said the pledge was aimed at boosting eroding investor confidence in the companies.

Bernanke said the "best solution" is to keep Fannie and Freddie "in their current form" as opposed to having the government take them over. It is also vital for Congress to boost regulatory oversight on the two companies. Such powers are contained in a sweeping housing-rescue package. Congressional leaders plan to add to the bill the provisions Paulson is seeking to aid Fannie and Freddie.

