Senate Majority Leader Mitch McConnell (R-Ky.) walks to the Senate floor before a vote to end a government shutdown early Friday. (Joshua Roberts / Reuters)

WASHINGTON ― Hours past a government funding deadline, Congress sped a massive bipartisan spending deal through both chambers early Friday, averting the furlough of hundreds of thousands of government workers.

After Sen. Rand Paul (R-Ky.) held up the bill until after 1 a.m. ― setting off a technical lapse in government appropriations ― the Senate approved the six-week funding extension and spending limit deal 71-28. A few hours later, racing the bill through procedures that normally take hours, the House passed the bill 240-186, with 67 Republicans and 119 Democrats opposed, and 167 Republicans and 73 Democrats in favor. (The Republican vote totals flipped almost completely from the previous two-year budget deal, when it passed with 79 Republicans voting yes and 167 voting no.)

Friday’s vote in the House culminated in a bizarre standoff, with Democrats holding back the vast majority of their votes to show just how many Democratic votes Republicans needed to pass the bill. About 40 Republicans, for their part, also held off voting on the bill, waiting for Democrats to put up more votes before they themselves voted no.

In the end, under the threat of the presiding officer closing the vote at the expiration of the 15 minutes allotted for the roll call, Democrats began changing their votes in favor of the bill. At about 5:30 a.m., the bill passed. President Donald Trump signed the bill Friday morning.

House Minority Leader Nancy Pelosi (D-Calif.) continued her opposition to the legislation Friday morning, insisting once again that Speaker Paul Ryan (R-Wis.) give Democrats the same assurances that Senate Majority Leader Mitch McConnell (R-Ky.) gave Senate Democrats ― that Democrats would have a level playing field for offering amendments to a bill to help undocumented young people losing Deferred Action on Childhood Arrivals program protections.

In the end, neither Pelosi’s demands nor the voting games mattered, as a critical number of Democrats supported the bill.

The legislation is a massive spending deal. In addition to the six-week extension of government funding, it would raise spending by roughly $320 billion, providing $80 billion above the spending caps for defense and $63 billion for non-defense for this year, and another $85 billion more for defense and $68 billion more for non-defense for the next fiscal year. The agreement also sets up $140 billion in war funding and $20 billion more for other emergency spending over two years, and throws in $89 billion for disaster relief.

In spending, it’s a huge win for Democrats, but they did not get the assurances they wanted on DACA, meaning House Republicans are free to bring up an immigration bill that they want rather than one that hews closer to Democratic priorities.

Democrats still hope that, because McConnell has made those open amendment concessions, and because the Senate is expected to go first on a DACA bill, there will be pressure on Ryan to put the Senate immigration measure up for a vote in the House.

If Ryan doesn’t, Democrats still have the remaining omnibus bill as leverage ― Friday’s deal was simply to allow lawmakers time to write an actual measure spending the money they approved. But their opportunities to extract concessions are waning, and unless the bill that comes out of the Senate is assured a vote, Democrats may have just let go of a key piece of influence they had over the eventual immigration product.

Immigrant rights advocates have argued since September, when Trump rescinded DACA, that the best chance for helping its recipients would be getting protections attached to a must-pass bill, like government spending. Their fear is that as a stand-alone bill could be riddled with poison pills — or not brought for a vote at all. Trump is demanding significant border security investments, including his wall, massive legal immigration cuts, and changes to asylum law in order to approve protections for undocumented young people who came to the U.S. as kids, which could sink a deal.

Thousands of DACA recipients have already lost their status, but the number will jump by an estimated 1,000 people losing protections each day starting March 6, due to the way Trump phased out the program. That’s why some lawmakers say the deadline for action is March 5, even though DACA recipients can currently apply to renew their protections under a court order that the Trump administration is fighting.

Ahead of the vote, Ryan told lawmakers that he was committed to working toward a bipartisan immigration deal that Trump would support. That’s still not the commitment Democrats wanted in exchange for their votes on the funding bill, but Ryan has suggested he wants a solution on DACA that can pass Congress, which suggests the need for Democratic votes anyway.

“My commitment to working together on an immigration measure that we can make law is a sincere commitment,” Ryan said just before the vote. “We will solve this DACA problem.”