The stalemate over funding for the Department of Homeland Security (DHS) was broken Wednesday as the Senate voted 98-2 to proceed to legislation that would prevent a partial government shutdown.

Democrats agreed to support the DHS bill after Senate Majority Leader Mitch McConnellMitch McConnellRocky rollout for Senate healthcare bill Overnight Healthcare: Latest on Senate healthcare bill | Four conservatives say they'll oppose | Obama slams bill | Health groups offer scathing criticism Sanders: I hope McConnell listened to protesters outside his office MORE (R-Ky.) stripped out provisions inserted by the House that would reverse President Obama's executive actions on immigration. 

The only votes against proceeding to the bill came from Sens. James InhofeJames InhofeMcCain strikes back as Trump’s chief critic Turbulence for Trump on air traffic control Parliamentarian threatens deadly blow to GOP healthcare bill MORE (R-Okla.) and Jeff SessionsJeff SessionsSessions backs LGBT Pride Month event Overnight Cybersecurity: Trump tweetstorm on Russia probe | White House reportedly pushing to weaken sanctions bill | Podesta to testify before House Intel Grassley: Comey must say if FBI investigated Sessions MORE (R-Ala.).

"Democrats will support getting on the House Homeland Security funding bill. In exchange, the leader will provide the only amendment, [it] will be a clean Homeland Security funding substitute," Senate Minority Leader Harry ReidHarry ReidDems see surge of new candidates Dems to grind Senate to a halt over ObamaCare repeal fight GOP fires opening attack on Dem reportedly running for Heller's Senate seat MORE (D-Nev.) said. 

Democrats had blocked the bill four times before. With a shutdown of DHS set to begin on Saturday, McConnell on Tuesday agreed to split the funding and immigration fights, as Democrats have long demanded.

Reid said earlier Wednesday that the Senate could take a final vote on the DHS bill Thursday. 

"We look forward to working with our Republican colleagues in the next 24 hours to get this done. All eyes now shift to the House of Representatives," Reid said.

If the Senate passes the funding bill, as expected, it would head back to the House, where its fate is unclear.

Speaker John BoehnerJohn BoehnerJuan Williams: GOP fumbles on healthcare The Hill's 12:30 Report The new dealmaking in Congress reveals an old truth: majority wins MORE (R-Ohio) was silent Wednesday on the "clean" funding plan and said the House would wait for the Senate to act.

“Until the Senate does something, we're in a wait-and-see mode,” BoehnerJohn BoehnerJuan Williams: GOP fumbles on healthcare The Hill's 12:30 Report The new dealmaking in Congress reveals an old truth: majority wins MORE said.

Several conservative Republicans have criticized the "clean" plan, with many vowing they will not vote to fund agencies that would be carrying out Obama’s immigration order.

McConnell said separating the two proposals would give Democrats who have previously criticized Obama's immigration action a chance to "prove they're serious."

“Many Senate Democrats led their constituents to believe they’d do something. … We’ve since heard excuses for the Democrats' refusal to do so,” McConnell said. “But the time for refusal has passed.”

Senate Republicans plan to bring up a separate bill that would block Obama's 2014 executive action, which would provide deferred deportations and work visas to millions of illegal immigrants.

Senate Democrats have made clear they would block motions to move to debate on that proposal, put forward by Sen. Susan CollinsSusan CollinsRocky rollout for Senate healthcare bill Overnight Healthcare: Latest on Senate healthcare bill | Four conservatives say they'll oppose | Obama slams bill | Health groups offer scathing criticism The Hill's Whip List: Senate ObamaCare repeal bill MORE (R-Maine), until the House and Senate both pass funding for Homeland Security.

“We’re happy to debate it. We won’t put procedural barriers in the way of debating it once a fully funded DHS bill is on the president’s desk to be signed. That is our view,” Sen. Charles SchumerCharles SchumerFCC advances proposal to unmask blocked caller ID in threat cases Trump: Pelosi's leadership good for the GOP Live coverage: Senate GOP unveils its ObamaCare repeal bill MORE (D-N.Y.), the third-ranking Senate Democrat, told reporters Wednesday.

— Last updated at 4:45 p.m.