House Republicans voted to approve a bill to fund President Donald Trump’s $5 billion demand for a border wall, setting up a final showdown in the Senate ahead of Friday’s deadline to avert a government shutdown.

The vote received no Democratic support, and the bill’s prospects in the Senate are dim as Democrats have pledged to defeat the divisive measure.

The final tally was 217-185, with eight Republicans voting against the package, which includes $5.7 billion to construct a border wall, $7.8 billion for disaster relief and would fund the government until Feb. 8.

Trump praised House Republicans for passing the measure Thursday night, while noting that upcoming speaker of the House, Nancy Pelosi, said last week in the Oval Office that the GOP did not have the votes.

Rep. Mark Meadows, the chair of the House Freedom Caucus and driving force behind convincing Trump to reject a bill without border wall funding, conceded that the bill is unlikely to clear the Senate. But Meadows said he hoped the successful House vote would push the upper chamber to strike a deal to pass some additional funding for the wall.

“I do believe that Sen. Schumer is a deal maker. I think that right now Sen. Schumer, Sen. McConnell and the president can hopefully make a deal," Meadows, R-N.C., said.

Meadows, who joined the House GOP meeting with Trump at the White House on Thursday, said he does not believe the president would sign a stop-gap funding bill without $5.7 billion in wall funding -- even if both chambers fail to pass the measure and the House sends a “clean” measure to his desk Friday.

“It is a possibility that it gets put on the floor, but it’s not a possibility that it gets signed into law,” Meadows predicted. “He made that clear today.”

Thursday was full of drama, with Republicans racing across town to discuss a course of action with the president.

“I've made my position very clear: Any measure that funds the government must include border security. It has to. Not for political purposes but for our country, for the safety of our community,” Trump stressed. “This is not merely my campaign promise, this is the promise every lawmaker made. It is the solemn promise to protect and defend the United States of America. And it is our sacred obligation. We have no choice.”

House Speaker Paul Ryan emerged earlier Thursday afternoon from a last-minute White House meeting between Trump and House Republicans to say that the president told them he would refuse to sign a stopgap funding bill as it's currently written -- a measure that would avert a shutdown before a Friday midnight deadline.

Ryan told reporters that he and other GOP leaders were going back to try to add more border security funding to the legislation.

The vote passed Thursday just before 8 p.m., but before the bill could go to the Resolute Desk for the president's signature, the Senate must follow suit and pass the bill.

"The president informed us that he will not sign the bill that came over from the Senate last evening because of his legitimate concerns for border security, so what we're gonna do is go back to the House and work with our members," Ryan, R-Wis., said. "We want to keep the government open but we also want to see an agreement that protects the border."

Given that the bill needs Democratic support to clear the Senate, the exercise in trading spending bills with and without border wall funding seems to be futile.

"Today's events have made one thing clear, President Trump is plunging the country into chaos," Senate Minority Leader Chuck Schumer, D-N.Y., said shortly before the House vote. "The bottom line is simple: the Trump temper tantrum will shut down the government but it won't get him his wall."

Schumer said he hopes that House Republicans will consider a clean continuing resolution after the Senate rejects the GOP's package.

"We are completely ready as we have been for a while, for bipartisan, bicameral legislation to pass the appropriations law and have a continuing resolution for the seventh bill if we cannot come to terms on that. We've offered that to the president," House Minority Leader Nancy Pelosi, D-Calif., said. "The president is doing everything he can to shut the government down."

Trump had called the meeting with House Republicans on short notice amid criticism that he was "softening" on a key campaign promise.

"The president said what the Senate sent over is just kicking the can down the road," House Majority Leader Kevin McCarthy, R-Calif., said. "We want to solve this problem. We want to make sure we keep the government open and we're gonna work to make sure we have that done."

Earlier, White House press secretary Sarah Sanders announced, “At this moment, the president does not want to go further without border security, which includes steel slats or a wall. The president is continuing to weigh his options.”

Ryan declined to comment as he left the Capitol late Thursday morning and returned to the Capitol without engaging reporters.

Prior to the meeting, Scalise said he was hopeful that Republicans would pass a bill that meets the president's border wall demand.

"We're talking to the president about the best way to get the wall funded with a bill that actually funds the wall and funds the other agencies of government that expire on Friday," Scalise, a Louisiana Republican, said as he left the Capitol. "We wanna get the $5 billion to secure our border, and let the president have the tools he needs to keep this country safe."

Trump and Ryan spoke on the phone Thursday morning before the White House meeting, and all indications were that the call did not go well for House GOP leaders.

The president fired off a tweet, expressing frustrations that GOP leaders had promised he’d get border wall funding the last time Trump was cornered into signing a continuing resolution.

Ryan postponed a planned news conference, where reporters had anticipated GOP leaders would announce a path forward on government funding.

At the start of the day, the spending bill appeared to be sailing towards passage. Late Wednesday, the Senate passed a measure to extend current levels of government spending until Feb. 8, buying lawmakers time to enjoy the holidays and a few more weeks to negotiate a long-term deal.

The House was poised to act on the bill and kick the funding fight down the road -- members’ bags are packed, their tickets home booked for Thursday night -- but then conservatives made a move to blow it all up: urging the president to veto the stop-gap measure.

“This is a fumble, and we need to make sure that the president stays firm,” Meadows warned, as his caucus insisted the short-term deal include Trump's request to fund his border wall.

“He's promised not once, not twice, but three different times that he would get border wall funding, and here we are about to punt,” Meadows complained.

With Democrats about to take majority control of the House, conservatives at the Capitol realize this is their last best chance to get any funding for the wall, putting intense pressure on Trump, who is already being hammered by his far-right base for caving on his signature campaign pledge.