A breakdown in the nation's foreclosure process threatens to create billions of dollars in losses for federally controlled mortgage finance companies Fannie Mae and Freddie Mac, highlighting how improper actions by banks could impose new costs on taxpayers, said government officials and industry sources.

To protect themselves from those losses, Fannie and Freddie have threatened to penalize thousands of lenders if they fail to rapidly fix the way they seize the homes of borrowers who missed their payments, according to letters sent by the firms to lenders.

Fannie and Freddie, the recipients of a $160 billion federal rescue, have been virtually the only companies willing to buy mortgages from lenders since the financial crisis broke out. The two firms can impose penalties on the industry based on the agreements they fashioned with lenders who collect payments from borrowers on their behalves.

In letters and in a conference call Thursday, Fannie and Freddie told the lenders they would be on the hook for any losses the two mortgage companies might suffer as a result of flaws in the foreclosure process. Freddie has set a deadline of Monday for banks to respond, according to the letter.

Ed DeMarco, interim director of the Federal Housing Finance Agency, which oversees Fannie and Freddie, said the two firms are trying to come up with a "tailored approach" to the debacle.

"The country's housing finance system remains fragile, and we're trying to work through this subject in a way that's fair not just to delinquent householders but also servicers and mortgage investors and most of all is in the best interests of taxpayers and the housing market," he said.

The moves by Fannie and Freddie provide a way for the federal government to hold lenders accountable for improper foreclosures. Since the problems came to light, Obama administration officials have been in constant contact with Fannie, Freddie and their regulator, including in a conference call Monday.

In some of these meetings, administration officials have expressed concern about whether a nationwide moratorium on foreclosures would damage not only Fannie and Freddie but the fragile housing market as well.

"Where there are problems with a bank's foreclosure process, they need to stop that process, review it and fix it," Housing and Urban Development Secretary Shaun Donovan said in an interview. "The issue is, should every single bank in the country, even where no problem has been found in the process, should they be swept into the category of these irresponsible lenders who have clearly made mistakes?"

Lawsuits and interviews with judges show that lenders in many cases submitted fraudulent documents as they sought to evict struggling borrowers. The paperwork problems raise broader questions over whether the constant trading of mortgages on Wall Street left lenders without clear title to the properties they are trying to seize. Several federal agencies, such as the Justice Department and the Securities and Exchange Commission, are looking into the matter.

Banks have said a remedy will take only a few months, but some Obama administration officials are unsure whether the system can be fixed that quickly. On Friday, Bank of America froze foreclosures nationwide, and many other banks have stopped them in dozens of states. Litton Loan Servicing, the mortgage servicing unit of Goldman Sachs, on Monday halted some foreclosures so that it could review its procedures, a spokeswoman said.

If these freezes turn into a prolonged delay, Fannie and Freddie would face "billions" of dollars in losses, since the companies wouldn't be able to sell off properties that have fallen into foreclosure, said Anthony B. Sanders, a professor of real estate finance at George Mason University.