The House approved a sweeping budget deal early Friday morning that would fund the government through March 23, sending legislation to President Trump Donald John TrumpObama calls on Senate not to fill Ginsburg's vacancy until after election Planned Parenthood: 'The fate of our rights' depends on Ginsburg replacement Progressive group to spend M in ad campaign on Supreme Court vacancy MORE that would end a brief shutdown of the government that began at midnight.

The bill passed in a 240-186 vote despite opposition from most Democrats, who had sought a firmer commitment from Speaker Paul Ryan Paul Davis RyanKenosha will be a good bellwether in 2020 At indoor rally, Pence says election runs through Wisconsin Juan Williams: Breaking down the debates MORE (R-Wis.) that he will bring immigration legislation to the floor for a vote that would protect immigrants who came to the United States as children from deportation.

ADVERTISEMENT Democrats nonetheless tried to make GOP leaders sweat. They held out their votes until the final minutes, when it was clear that a majority of the GOP conference supported it. At first, Republicans were the only ones casting votes as Democrats sat largely in silence. Then the "no" votes ominously began piling up, only for enough Democrats to eventually neutralize the GOP defections. Gamesmanship from both parties was repeatedly on display, with Democrats warning Republicans they could not count on the minority delivering votes. Republicans, for their part, repeatedly played it cool in public, offering confidence the measure would pass despite opposition from conservative Republicans who said the new spending added too much to the deficit. House Democrats just barely made up for the defections on the GOP side. A total of 73 Democrats voted for the legislation, while 67 Republicans voted against it. In his closing remarks, Ryan noted the bipartisan 71-28 Senate tally and said that 75 percent of Senate Democrats and 68 percent of Senate Republicans had voted for it.

The early vote took place because of Sen. Rand Paul Randal (Rand) Howard PaulSecond GOP senator to quarantine after exposure to coronavirus GOP senator to quarantine after coronavirus exposure The Hill's Morning Report - Sponsored by National Industries for the Blind - Trump seeks to flip 'Rage' narrative; Dems block COVID-19 bill MORE (R-Ky.), who blocked action in the Senate for must of Thursday with a demand on an amendment leaving previous ceilings on federal spending in place.

"What you're seeing is recklessness trying to be passed off as bipartisanship,” Paul said in a Senate floor speech.

Paul used Senate rules to delay a vote in the Senate until early Friday morning, angering his colleagues in the process.

In an extraordinary exchange on the Senate floor, the No. 2 Senate Republican, John Cornyn John CornynBipartisan praise pours in after Ginsburg's death Chamber of Commerce endorses McSally for reelection Airline job cuts loom in battleground states MORE (Texas), accused Paul of pushing to "effectively shut down the federal government for no real reason."

"I don't know why we are basically burning time here while the senator from Kentucky and others are sitting in the cloakroom wasting everybody's time and inconveniencing the staff," Cornyn said.

Sen. John Thune John Randolph ThuneWhat Senate Republicans have said about election-year Supreme Court vacancies The Hill's 12:30 Report - Presented by Facebook - Don't expect a government check anytime soon The Hill's Morning Report - Sponsored by The Air Line Pilots Association - Trump contradicts CDC director on vaccine, masks MORE (R-S.D.), a typically even-keeled lawmaker who said he passed the time by watching Netflix and the NBA, called Paul's tactics a "colossal waste of everyone’s time.”

In the House, Republicans warned that Democrats would own the shutdown if enough of them voted against the spending deal.

The debate took place just a few weeks after Democrats in the Senate blocked a House stopgap bill funding the government, triggering a three-day shutdown in January. That fight was also instigated by the battle over immigration — and specifically Democratic demands for legislation to replace the Deferred Action for Childhood Arrivals program that President Trump is unwinding.

The deal passed by Congress sets the stage to boost federal spending for both defense and nondefense programs by $300 billion over the next two years and will suspend the debt ceiling for one year, knocking two major to-do items off lawmakers’ list.

The bill will fund the government until March 23, which will give lawmakers time to write an omnibus spending bill for the rest of the fiscal year and break the pattern of gridlock that has led to five temporary funding patches since September.

The deal also includes a number of other priorities for both parties, including nearly $90 billion for disaster relief, $6 billion to address the opioid crisis, a four-year extension of the Children's Health Insurance Program and more than $7 billion for community health centers.

Yet for all the sweeteners that were loaded onto the agreement, moving the deal through Congress wasn’t without its share of drama.

As part of the deal to end the previous shutdown last month, Senate Majority Leader Mitch McConnell Addison (Mitch) Mitchell McConnellObama calls on Senate not to fill Ginsburg's vacancy until after election Planned Parenthood: 'The fate of our rights' depends on Ginsburg replacement Progressive group to spend M in ad campaign on Supreme Court vacancy MORE (R-Ky.) pledged to allow floor debate on immigration as soon as next week.

But Ryan would not make any assurances that the House would take up any bipartisan bill passed by the Senate or allow open-ended debate on immigration.

“We will bring a solution to the floor, one the president will sign,” Ryan said during a news conference on Thursday.

But Ryan expressed reluctance to move forward with legislation lacking Trump’s support.

“I don't want to just risk a veto,” Ryan said.

Pelosi set the record on Wednesday for the longest continuous floor speech demanding a commitment to allow a vote on bipartisan legislation to protect "Dreamers." She opposed the budget deal — which she helped negotiate with other congressional leaders — but indicated to her caucus that they could vote as they saw fit.

Just as the shutdown began at midnight Thursday night, House Democratic leaders again urged Ryan to make a public statement committing to open floor debate on a variety of immigration proposals.

“We strongly believe that Members of the House and their constituents deserve the same dignity that Leader McConnell has extended to Members of the Senate by allowing for a vote on this issue,” Pelosi, Minority Whip Steny Hoyer Steny Hamilton HoyerHouse Democrats postpone vote on marijuana decriminalization bill Democrats scramble on COVID-19 relief amid division, Trump surprise The Hill's Morning Report - Sponsored by The Air Line Pilots Association - Pence lauds Harris as 'experienced debater'; Trump, Biden diverge over debate prep MORE (D-Md.) and Assistant Minority Leader James Clyburn (D-S.C.) wrote in a letter to Ryan.

Meanwhile, Ryan was also facing a revolt from within his own ranks, as scores of House conservatives slammed the budget deal as fiscally irresponsible and vowed to oppose the legislation.

Ryan and his leadership team were forced to lean on both Democrats and GOP defense hawks to largely supply the votes for the budget deal.

At a press conference earlier in the day, Ryan — flanked by a number of House Armed Services Committee members — touted the budget deal’s boost for the U.S. military.

Even Defense Secretary James Mattis James Norman MattisBiden courts veterans amid fallout from Trump military controversies Trump says he wanted to take out Syria's Assad but Mattis opposed it Gary Cohn: 'I haven't made up my mind' on vote for president in November MORE joined the last-minute push to wrangle up support from defense hawks, making phone calls to lawmakers in the hours before the midnight deadline, according to one source.

In the Senate, Paul spent most of the late-night vote series ducked in the cloakroam, largely avoiding his colleagues whom he forced to be there until around 2 a.m.