Updated

The House of Representatives Thursday approved a bill that would fund most of the federal government through early February -- and provides $5.7 billion for President Trump's long-promised border wall, increasing the chances of a partial government shutdown later this week.

Eight Republicans joined all 177 voting Democrats to oppose the measure, which passed 217-185. The bill now goes to the Senate, where it is certain to fall short of the 60 votes needed for passage since the chamber's 49 Democrats are against funding the wall. That, in turn, makes it more likely that parts of the federal government, including nine of 15 Cabinet-level departments and dozens of agencies, will cease operations at midnight Friday.

The vote came hours after Trump told House GOP leaders that he would not enact a Senate-passed package that does not provide money for the barrier.

CLICK HERE TO GET THE FOX NEWS APP

Members of the conservative House Freedom Caucus, whose leaders had pushed the hardest for Trump to stand his ground on the wall issue, said in a statement: "Republicans in Congress have continually told the American people that we would fight for wall funding, and today the House of Representatives took its first step toward fulfilling that promise. The Senate must follow our lead. It’s time we do what we said and work with President Trump and the American people to secure our borders."

Trump congratulated Republican House members in a tweet late Thursday, saying he was "so proud of you all."

"Thank you to our GREAT Republican Members of Congress for your VOTE to fund Border Security and the Wall," he wrote. "The final numbers were 217-185 and many have said that the enthusiasm was greater than they have ever seen before ... Now on to the Senate!"

In a subsequent tweet, Trump took a shot at House Minority Leader Nancy Pelosi, D-Calif., who he said had claimed that "Republicans didn’t have the votes for Border Security."

"Nancy does not have to apologize," Trump said. "All I want is GREAT BORDER SECURITY!"

The Senate measure, which passed by voice vote late Wednesday, provided a total of $1.6 billion for border security but did not include funding for a border wall. Trump's allies had warned him that he would have even less leverage to demand wall funding after Democrats take control of the House on Jan. 3 and worried that Trump's failure to make good on his signature campaign promise could hamper his re-election campaign.

After meeting with Trump at the White House earlier Thursday, House Speaker Paul Ryan, R-Wis., and House Majority Leader Kevin McCarthy, R-Calif., told reporters that Trump had told them he would not sign the measure out of "legitimate concerns for border security."

Conservative talk radio host Rush Limbaugh said Trump had "gotten word" to him that he would either be "getting funding to the border or he's shutting the whole thing down." A day earlier, Limbaugh complained that it appeared "Trump gets nothing and the Democrats get everything, including control of the House."

The president issued threatening tweets and a stern statement from his press secretary before calling Republican lawmakers to the White House, where he told them he wasn't on board with the Senate measure, which would fund much of the government through Feb. 8.

"I am asking Congress to defend the border of our nation," Trump said at a White House event. "Walls work, whether we like it or not."

TRUMP REFUSES TO BACK GOVERNMENT FUNDING DEAL, PRESSES FOR BORDER WALL MONEY

Ratcheting up the suspense, Trump added: "I look forward to signing a bill that fulfills our fundamental duty to the American people ... we'll see what we can do."

Democratic leaders were incredulous Thursday evening, with Senate Minority Leader Chuck Schumer, D-N.Y., saying the president was throwing a "temper tantrum."

"Today's events have made one thing clear: President Trump is plunging the country into chaos," said Schumer, referencing the resignation of Defense Secretary James Mattis in addition to the pending shutdown. " ... The  Trump temper tantrum may produce a government shutdown. It will not get him his wall ... Donald Trump wants a shutdown and [Republicans] seem to be so afraid that they're going to go along. We'll see."

Pelosi said the measure to fund a border wall was "a shameful bill that is unworthy of this House of Representatives and certainly of the American people."

On the House floor, Minority Whip Steny Hoyer, D-Md., accused Republicans of "playing political games ... to pander to the president of the United States."

"How sad it is that the Republican leadership of this Congress ... have consistently been unable to meet their fiscal responsibilities," Hoyer said. " ... This bill is going nowhere. The Senate won't accept it. Now perhaps the Senate will send it back amended. Perhaps."

Despite his line in the sand, Trump appeared to float one possible path to compromise, referring to "steel slats" at the border rather than the concrete barrier he'd talked about during the campaign. With that phrasing, Trump appeared to be describing fencing, to which Congress is more amenable.

The White House had previously floated another possible workaround, suggesting Trump would approve a deal with no wall dollars and pursue other funding options. Trump said he would use the military to fund and build the wall, while White House Press Secretary Sarah Sanders said Trump had directed all his Cabinet secretaries to look for usable funds.

Fox News' Alex Pappas and The Associated Press contributed to this report.