Fannie Mae and Freddie Mac are central to the US housing market
US President George Bush says mortgage giants Freddie Mac and Fannie Mae have been taken over because they posed "an unacceptable risk" to the economy.
The two companies account for nearly half of the outstanding mortgages in the US, and have lost billions of dollars during the US housing crash.
The most recent figures show about 9% of US mortgage holders were behind on their payments or faced repossession.
The federal takeover is one of the largest bail-outs in US history.
It was announced on Sunday by Treasury Secretary Henry Paulson.
"Putting these companies on sound financial footing, and reforming their business practices, is critical to the health of our financial system," President Bush said.
"The actions taken today are temporary, and will support housing finance in the near term."
As part of the changes, the management of the two companies will be replaced while the firms will be given access to extra funding to support their business going forward.
Treasury Secretary Henry Paulson said the government was intervening in the wider interests of the financial system and of taxpayers since the financial position of the two firms was fast deteriorating.
A failure of either of them would create great turmoil in financial markets here and around the globe
He added that the two firms' debt levels posed a "systemic risk" to financial stability and that, without action, the situation would get worse.
"We examined all options available and determined this comprehensive and complementary set of actions best met the objectives of market stability, mortgage availability and taxpayer protection," he said.
"Fannie Mae and Freddie Mac are so large and interwoven in our financial system that a failure of either of them would create great turmoil in financial markets here and around the globe."
US treasury statement on the future of Freddie Mac and Fannie Mae
The move is intended to keep the two companies afloat, amid fears that either could go bankrupt as borrowers default on their home loans.
The two firms will be administered by the Federal Housing Finance Agency until their long-term future is decided.
The Congressional Budget Office has said such a move could cost up to $25bn but Mr Paulson said there was no reason why taxpayers should have to directly foot the bill.
Together, Freddie Mac and Fannie Mae own or guarantee about $5.3 trillion (£3 trillion) of mortgages.
But they have made a combined loss of about $14bn in the past year and officials were worried that they would no longer be able to continue functioning if such losses continued.
For the US Treasury, the bailout could turn out to be one of the most expensive financial rescues in history
The Treasury's funding guarantees to the two firms - which will include it buying up high-risk mortgage backed securities used to fund the mortgage market - will last until the end of 2009.
During that period, neither Fannie Mae nor Freddie Mac will be able to make any payments to their shareholders.
But Mr Paulson warned that the move was only a short-term "stabilisation" exercise.
He said it would be up to Congress to agree proposals to reform the two firms and address their "pervasive weaknesses".
Federal Reserve chairman Ben Bernanke said he "strongly endorsed" the proposals to ensure the two firms remained financially sound.
"These necessary steps will help to strengthen the US housing market and promote stability in our financial markets," he said.
Banks around the world are highly exposed to the two companies and therefore, given the febrile state of markets across the world, it had become dangerous for doubts to persist about whether they were viable and would be able to keep up the payments on their massive liabilities, says the BBC's business editor Robert Peston.
A rescue plan passed by Congress in July gave the US government the authority to offer unlimited liquidity to the two companies, and to buy their shares, in order to keep them afloat.
In an earlier version of this story we erroneously reported that more than 9% of all US homeowners were behind on their payments or facing repossession. This numbers applies to mortgage holders only.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.