Odd alliances are at work as President Bush and congressional Democrats band together to save Fannie Mae and Freddie Mac.

The push to reassure markets that the mortgage giants are financially healthy has thrust Republicans — who have never liked the idea of government-sponsored mortgage companies — into the arms of Democrats, who have long championed Fannie's and Freddie's mission of helping low- and middle-income Americans buy homes.

Now they are both pushing for a government lifeline to the companies as part of a broad housing bill compromise that tightens controls on them and rescues as many as 400,000 homeowners from foreclosure.

It's a case of economic reality trumping partisan ideology, with housing woes and fears about the mortgage giants' stability threatening financial markets in the U.S. and abroad.

"Nothing concentrates the mind like a death sentence," said Sen. Christopher J. Dodd, D-Conn., the Senate Banking Committee chairman. "I went from dealing with an administration that didn't want to do anything to one that wants to do everything."

The leading administration advocate for the bargain is Treasury Secretary Henry M. Paulson, the former Goldman Sachs executive who has long fought for legislation to more tightly regulate Fannie Mae and Freddie Mac.

Now it's Paulson — representing an administration that has tried to distance the government from the two mortgage giants — who argues he needs power to extend them an unlimited line of credit and buy their stock to reassure the markets that they remain financially healthy amid a housing crisis.

Paulson, mused Rep. Barney Frank, D-Mass., is "getting more cooperation here, and more constructive discussion (from Democrats), than he's getting with the Republicans."

The irony is particularly galling to GOP conservatives who have long railed against Fannie and Freddie, saying the government needed to rein in and even dismantle them.

"Strange things are occurring. ...There has been a massive shift in the Bush administration policy," said Rep. Patrick McHenry, R-N.C. "I don't see rank-and-file Republicans following the dictates of the Bush administration on this."

When he saw Treasury's plan for Fannie Mae and Freddie Mac, Sen. Jim Bunning, R-Ky., grumbled, "I thought I woke up in France. But no, it turned out it was socialism here in the United States of America."

Fannie Mae and Freddie Mac are private companies that together hold or guarantee more than $5 trillion in home loans — almost half the nation's total. They provide huge amounts of cash flow to the mortgage markets by buying up loans from banks. Their pseudo-governmental status confers lucrative benefits, exempting them from some taxes, letting them hold less capital than required of banks, and — most significantly — allowing them to borrow at rates much cheaper than other companies because investors believe that the government will never let them falter.

The very idea of government-chartered private mortgage companies flies in the face of Republican free-market principles. That's especially true since the companies were created by Congress in part to help lower-income people get mortgages, and have as part of their mission creating affordable-housing opportunities.

"Fannie and Freddie have always been closer to Democrats," said David C. John, an analyst at the conservative Heritage Foundation.

John, who was a staff aide on the House Banking Committee in the late 1980s, said Democrats would line up to sit on the panel that oversaw housing. "Republicans would say, 'Oh gee, do I have to?"'

Still, the companies — well aware that they needed broad congressional support to continue their unusual status — have one of the most sophisticated and expensive political operations in Washington, D.C., and have forged close relationships with lawmakers in both parties. Their executives have included a succession of Democratic heavy hitters, and they employ a who's-who of influential Democrats and Republicans — including people with ties to both parties' presidential candidates — as lobbyists.

Members of both parties now see the two companies as indispensable to the mortgage market, and to financial markets in general, calling them "too big to fail." It's that reality that has sparked the unlikely partnership between the Bush administration and Democrats to keep them afloat.

"This is a dramatic reversal by the Bush administration considering their views of the federal ties to Fannie and Freddie," said Howard Glaser, a mortgage industry consultant who served in the Housing and Urban Development Department in the Clinton administration.

The turnabout reflects a recognition that, "when push comes to shove, there's no option but to have the federal government stand behind Fannie and Freddie. The housing market depends on it, and to a great degree, global investment in the United States depends on it," Glaser said.

Republicans aren't the only ones in an unfamiliar spot, however. The housing measure that's the vehicle for the Fannie and Freddie rescue creates a strong new regulator for the companies. In light of the rescue request from Paulson, Frank says Congress will add even more explicit restrictions, such as subjecting the pay packages of Fannie and Freddie executives to government approval.

"You have the strongest proponents of Fannie and Freddie who are now finding themselves pretty much presiding over, at the very least, their weakening, if not dismantling," John said. "There's loads of irony all over the place."