Updated

The House rejected a short-term spending bill for the Homeland Security Department on Friday, the last day for funding to avoid a partial shutdown.

The surprise 224-203 defeat of the legislation was a major embarrassment for House GOP leaders. Next steps were not immediately clear.

Some conservatives opposed the bill because it left out provisions to block executive actions President Barack Obama took on immigration, which Republicans have vowed to overturn.

House leaders tried to win lawmakers over arguing a three-week extension bought them more time to fight Obama while his immigration directives are on old in court.

But conservatives abandoned the bill in droves and Democrats refused to make up the difference, pressing for a full-year funding bill instead.

An earlier vote in the House on Friday clearing the way for final passage of the bill was approved 240-183.

But in the hours after, the outcome began to look uncertain as Republican leaders sent the House into recess as they sought the difficult task of rounding up the votes they needed to pass the bill.

Democrats announced their opposition to the three-week measure, forcing House Speaker John Boehner to rely solely on GOP votes.

And conservative lawmakers who have thwarted Boehner's plans on a variety of issues were balking because the legislation doesn't undo President Barack Obama's executive actions granting work permits to millions of immigrants in the United States illegally.

"I am not going to vote under any circumstances to fund illegal conduct," said Rep. Mo Brooks, R-Ala. "It does not make any difference whether the funding is for three weeks, three months or a full fiscal year. If it's illegal, it's illegal."

GOP leaders urgently pleaded for the measure before the vote on Friday.

Without action, DHS was scheduled to start shutting down at midnight Friday, furloughing 30,000 workers. Another 200,000 would be deemed essential and continue to report to work, albeit without pay.

"The House must pass this bill in short order to keep the lights on at the Department of Homeland Security in the near term," said Rep. Harold Rogers, R-Ky. "Hopefully, this will buy us this additional time that we clearly need."

As debate proceeded in the House, the Senate voted 68-31 to approve a full-year bill free of contentious immigration provisions.

The defeated bill called for extending current DHS funding levels for the department until March 19.

Shortly before the House vote defeating the bill, House Minority Leader Nancy Pelosi, a California Democrat, said: "It’s another instance where the Senate Republicans and Democrats have come together – whether it was the Violence Against Women Act; whether it was Homeland Security; whether it was legislation that related to payroll taxes a couple of years ago; comprehensive immigration reform – [and] House Republicans have just painted themselves into a corner."

"And even the Senate Republicans are asking them to send this and pass this bill.  I thank the Senate Republicans and Democrats for their leadership in passing this important legislation, and wish that the Republicans in the House would learn from that.”

Leadership-aligned lawmakers sought to win over conservatives arguing that a federal judge has already put Obama's policies on hold. That argument was unpersuasive to some.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino