The House on Saturday approved a “clean” stopgap funding bill to avert a government shutdown, sending the legislation to the Senate for consideration hours before the midnight funding deadline.

The measure would keep the government funded at current spending levels through Nov. 17 and it includes $16 billion in disaster relief — matching the figure the White House included in a supplemental request. It does not include Ukraine aid or border policy changes.

The chamber cleared the stopgap bill in an overwhelmingly bipartisan 335-91 vote hours after Speaker Kevin McCarthy (R-Calif.) rolled out the proposal. One Democrat and 90 Republicans voted against the measure.

The plan marked a stark shift in his posture when it comes to government funding. And it could spell trouble for his Speakership as conservatives heighten their threats to confiscate his gavel.

But the decision is poised to prevent the government from falling off the shutdown cliff, which many lawmakers thought was inevitable after weeks of disagreements within the House GOP conference and between both chambers.

“Just moments ago on the House floor we passed by overwhelming numbers the ability to keep government open for the next six weeks,” McCarthy said in a press conference following the vote.

Senate Minority Leader Mitch McConnell (R-Ky.) announced shortly before the House voted that members of his conference would not allow the upper chamber’s bipartisan continuing resolution (CR) to advance, deferring to the House plan. The Senate’s proposal would keep the government funded through Nov. 17 and it includes $5.99 billion in disaster relief and $6.15 billion in Ukraine aid.

That message was a welcome communication for McCarthy, who told members of his conference earlier this week that he would not bring the Senate measure to the floor for a vote after a number of conservatives voiced concern with the inclusion of Ukraine funding and the lack of border security provisions. Support for Ukraine has become a hot-button issue in the House GOP conference.

The Senate is scheduled to vote on the House bill Saturday evening.

While the House vote marked a large step forward in averting a shutdown, it did not come without its fair share of drama.

House Democrats deployed a number of stall tactics ahead of Friday’s vote in an effort to buy time to review the 71-page bill, which had been unveiled earlier in the day. Democrats were concerned that language in the legislation could lead to members getting a pay raise and would deny resources for the Department of Education’s Office of Federal Student Aid.

House Democratic Whip Katherine Clark (Mass.) brought a motion to adjourn, and members slowly trickled into the chamber to cast their vote. The motion failed 0-427, but the vote ate up more than an hour of time.

House Minority Leader Hakeem Jeffries (D-N.Y.) then took to the House floor for a “magic minute,” which allows leaders to speak in the chamber for an unlimited amount of time. He spoke for more than 50 minutes.

As the time passed, Democrats huddled behind closed-doors in the Capitol.

The House finally kicked off the highly anticipated vote just before 2:25 p.m., which quickly racked up support from both sides of the aisle.

McCarthy bringing a clean stopgap bill to the floor was a departure from his previous stance on government funding.

The Speaker in recent weeks had been pushing his conference to coalesce around a GOP-crafted stopgap bill that includes border security, a move that was designed to give Republicans greater leverage in negotiations with Senate Democrats and the White House. He had brushed aside the possibility of working with Democrats to avert a shutdown, underscoring the importance of getting border security provisions in any funding measure.

But on Friday, a band of 21 conservatives voted down that GOP stopgap bill, leaving McCarthy with few options to avert a shutdown ahead of the looming deadline. Hours after the failed vote, the Speaker floated a “clean” stopgap bill without Ukraine, following through with that idea Saturday morning.

“Let me tell you, today wasn’t the choice we wanted to have,” McCarthy said following Fridays’ vote. “We tried to pass the most conservative stopgap measure possible. We had members from all sides of the aisle work on it. We put it on the floor but unfortunately, we didn’t have 218 Republicans that would vote for that to help us secure the border then.”

“But today, we’re able to move forward to make sure we can challenge that,” he added.

Some Democrats also had qualms with the stopgap bill, particularly its lack of funding for Ukraine. The White House requested $24 billion for Kyiv in its supplemental request, and the Senate continuing resolution included $6.15 billion in aid for the embattled ally.

McCarthy, however, left money for Ukraine on the cutting room floor as a number of conservatives call for curtailing additional assistance to the country.

The lone Democratic “no” vote — Rep. Mike Quigley (Ill.) — pointed to the lack of Ukraine aid in the stopgap.

“The Republican Party has become the party of appeasers, pro-Putin folks,” Quigley said. “Today our folks were forced into a decision and no one wanted to make, have Americans suffer or do what we did today, which was to abandon Ukraine.”

“We gotta fix this in 45 days because right now, Putin is celebrating,” he added. 

While the Saturday vote brings the country one step closer to averting a shutdown, it also puts McCarthy at a greater threat of losing his gavel. Hard-line Republicans for weeks had been publicly warning that the Speaker could face a vote on his ouster if he worked with Democrats to fund the government.

“If Kevin McCarthy puts a continuing resolution on the floor, it’s going to be shot, chaser; continuing resolution, motion to vacate,” Rep. Matt Gaetz (R-Fla.), one of McCarthy’s foremost adversaries, said earlier this month.

McCarthy, for his part, brushed aside those threats on Saturday.

“If someone wants to remove because I want to be the adult in the room, go ahead and try,” he told reporters.

“But I think this country is too important. And I will stand with our military. I’ll stand with our border agents. I’ll stand with those that have to get their medicine from government as well,” McCarthy added. “I think that’s too important.”

Updated at 4:55 p.m.