President Obama on Saturday signed a three-day stopgap measure to fund the government through Tuesday, preventing a shutdown this weekend after the Senate ditched a controversial 2,000-page catchall spending bill.

The government was careening toward a temporary shutdown at 12:01 a.m. Sunday but the Senate followed the House Friday night in passing the short-term funding bill.

Congressional Democrats are also rushing to finish by Christmas work on a Senate ratification of a new arms control treaty, an end to the military's ban on openly gay service members and a pathway to legal status for hundreds of thousands of illegal immigrants brought to the country before the age of 16 who have attended college or served in the military.

But the most urgent issue on Friday was avoiding a government shutdown.

The House on Friday quickly approved a spending bill to fund the government through Tuesday, sending the measure over to the Senate. The House will now be out of session until Tuesday.

More On This...

Some House members wanted to vote on a spending bill that would keep the government afloat until February in part because 63 defeated Democrats have no offices and no place to go. They would like to go home, House leadership sources told Fox News.

In the upper chamber, senators were sent scrambling after Senate Majority Leader Harry Reid gave up Thursday on a $1.27 trillion bill loaded with more than $8 billion in home-state projects known as earmarks in Washington. Several Republicans who had been thinking of voting for it pulled back their support.

The package wrapped together 12 bills -- blending $1.1 trillion for the operating budgets of every federal agency with an infusion of $158 billion for military operations in Iraq and Afghanistan -- into a single foot-tall stack of legislation that Democrats had hoped to pass with just a couple of days' worth of debate.

But release of the bill on Tuesday sparked an outcry among the GOP's conservative political base. Senate Republicans held two combative closed-door meetings in which the rank-and-file turned up the heat on those few Republicans who were considering voting for the bill.

Republicans were also irate that the measure contained money to begin implementation of Obama's controversial health care law and a financial overhaul measure that all but a handful of Republicans opposed.

"The voters don't want us to wait to cut spending and debt and fight the health care bill next October – they want us to do these things immediately," Republican leader Mitch McConnell of Kentucky said in a statement Friday.

He proposed Thursday to keep the government running at current funding levels through Feb. 18. By then, Republicans will have taken over the House and bolstered their strength in the Senate, giving them greater leverage to force spending cuts.

But efforts next year to wrap up the unfinished budget work aren't likely to go smoothly, and there's the potential for a government shutdown if the process breaks down. A shutdown would mean furloughing all but essential federal workers and temporarily closing national parks and most agencies.

The sinking of the bill was a setback for Obama, who supported it despite provisions to block the Pentagon from transferring Guantanamo Bay prisoners to the United States and to fund a program to develop a second engine for the F-35 Joint Strike Fighter, which the administration says is a waste of money. Obama came under fire from Republicans for supporting the bill after promising after the election to take a harder line on earmarks.

The White House belatedly weighed in Friday behind a yearlong funding bill that's mostly frozen at current levels – a bill that passed the House last week.

Just Thursday, Defense Secretary Robert Gates came out against the House measure because it would cut the Pentagon $19 billion below levels in the failed Senate omnibus bill. Now, press secretary Robert Gibbs says the House bill would provide "certainty and continuity" that's preferable to kicking the unfinished budget work into next year.

The House and Senate typically spend months on the 12 annual spending bills, but Democrats didn't bring even a single one to the Senate floor this year, an unprecedented collapse of the appropriations process. The House only passed two of the 12 bills and didn't make any of the others 10 public.

Fox News' Chad Pergram and The Associated Press contributed to this report.