Almost everyone agrees that the federal government had to rescue the two tottering mortgage giants, Fannie Mae and Freddie Mac. It headed off a likely plunge into global economic chaos.

In its essentials, the Bush administration’s plan did what it had to do in what amounted to the biggest nationalization since World War II. It made explicit the government’s guarantee of the two entities when world confidence in them had begun to falter. It fired the executives who had led them into such trouble. It set the scene for effective government regulation of their lending and investment policies. And it called a halt to their massive lobbying that had shielded them from reform.

Putting the two agencies into conservatorship, a form of bankruptcy protection, keeps them in business as the present backers of three-quarters of U.S. mortgages now that Wall Street banks have pulled out of that market. And the pledged injection of up to $200 billion in federal funds will help them meet expected losses from mortgage defaults. Mortgage rates should fall, and the housing market should get a lift.

Above all, the new plan was a move to restore confidence of foreign investors, including the Bank of China and other government central banks, which hold an estimated 20 percent of Fannie and Freddy’s $5 trillion debt and had begun to sell the securities.

Uncertainties remain about the impact of the government’s intervention. No one knows what it will cost the taxpayers. An early estimate of $25 billion looks far too low. Officials haven’t said whether they will have the government buy into Fannie and Freddie to profit from their hoped-for recovery.

Immediate losers are the common and preferred stockholders in the two entities. Their dividends have been suspended, and their shares, which already had fallen sharply, will be practically worthless. Critics worry that those features will discourage future investment in Fannie and Freddie.

Injecting Treasury funds by buying new 10 percent senior preferred stock, as is the plan, would be a losing deal for the entities. They would be paying 10 percent for money to lend out as mortgages at around 6 percent. That means they would just be digging their hole deeper. Similarly, a part of the plan that would gradually shrink their business by 10 percent each year looks like an effort to save Fannie and Freddie for the present but then starve them or kill them.

So the plan is a necessary temporary fix, with the future of the two agencies being put off for action by a new Congress and a new president. The next step is to abandon the bad features of the plan and restore Fannie and Freddie to prudently regulated examples of healthy public and private interests serving the American people.