A bill that would fund the Department of Homeland Security while also unraveling President Obama's immigration actions failed on a test vote in the Senate on Tuesday, likely forcing majority Republicans to come back with an alternative plan ahead of a looming funding deadline.

The bill failed on a 51-48 vote in the Senate, after the House approved similar legislation last month. It needed 60 votes to advance in the Senate.

At least one Republican, Nevada Sen. Dean Heller, voted along with a unified Democratic caucus to block the bill.

Tuesday’s vote leaves the sticky question of how and whether Congress can hammer out a budget bill for DHS, before current funding expires Feb. 27.

Some Republicans wanted to use the funding bill as a vehicle to undo Obama's immigration actions, which aim to shield 4 million illegal immigrants from deportation.

Before the vote, Democrats claimed Republicans were risking shutting down a key government agency as global terror threats against the United States grow. Now, Senate Majority Leader Mitch McConnell, R-Ky., may have to come up with a new plan -- one able to attract a coalition of Republicans and Democrats.

The pressure from the party's right flank is not easing, however. House Majority Whip Steve Scalise, R-La., says the plan is to press Senate Democrats. He told Fox News he believes the senators who voted no “will start to hear from people back home.”

He added, “There’s not a plan B, because this is the plan.”

The president, meanwhile, reiterated his concerns that the battle over DHS funding was putting national security at risk ahead of the vote. He said department workers "need certainty in order to do their jobs."

Obama spoke at the beginning of a meeting with his Cabinet, a day after sending his $4 trillion budget to Congress. "The men and women of America's homeland security apparatus do important work to protect us, and Republicans and Democrats in Congress should not be playing politics with that," Obama said at DHS headquarters on Monday.

But Sen. John Cornyn, R-Texas, called on Democrats to allow debate on the funding bill and put the pressure back on the president.

“If the president wants Congress to pass a Department of Homeland Security appropriation bill, then he needs to talk to our friends in the minority here in the Senate who just blocked consideration of a $40 billion Department of Homeland Security funding bill,” he said.

Cornyn believes Democrats are refusing to let the bill go forward because “they don’t want to revisit the president’s own repeated assertions 22 different times when he said he didn’t believe he had the legal authority to issue the executive action that he issued in November of 2014.”

Democrats have said they oppose anything other than a clean funding bill. Though they're in the minority, they have leverage because Republicans only have a 54-seat majority -- and it takes 60 votes to advance such legislation.