The House passed a short-term extension of government funding late Thursday after Republican leaders, with help from President Donald Trump, cobbled together enough GOP votes to overcome an internal revolt.

Still, the possibility of a federal shutdown moved closer to a certainty after Senate Democrats rallied against the GOP proposal, announcing they would not lend their votes to a bill that did not reflect their priorities on immigration, government spending and other issues.

By Thursday evening, nine Senate Democrats who had voted for a spending measure in December said they would not support the latest proposed four-week extension, joining 30 other Democrats and at least two Senate Republicans - and leaving the bill short of the 60 votes needed to advance.

As a result, Republican leaders - long on the defensive against claims that they were failing to govern - appeared emboldened as they sought to cast the Democrats as the obstacle to a compromise to keep critical government functions operating.

"My Democratic colleagues' demands on illegal immigration, at the behest of their far-left base, have crowded out all other important business," Senate Majority Leader Mitch McConnell, R-Ky., said Thursday night. "And now they are threatening to crowd out the needs of veterans, military families, opioid treatment centers and every other American who relies on the federal government - all over illegal immigration."

Senators of both parties voted to open debate on the House bill late Thursday, but Senate Minority Leader Charles Schumer, D-N.Y., said Democrats remained opposed to the measure and proposed a spending extension that would last just a few days to allow talks on a broader agreement to continue.

"We have to sit down together and solve this, with the president or without," he said.

Republican leaders rejected that suggestion. They did not lay out a Plan B to pursue if the House bill is ultimately rejected, except to point blame at Democrats for a shutdown.

"I ask the American people to understand this: The only people in the way of keeping the government open are Senate Democrats," House Speaker Paul Ryan, R-Wis., said Thursday night. "Whether there is a government shutdown or not is entirely up to them."

Senate GOP leaders prepared to force Democrats into a series of uncomfortable votes, aimed at splitting their ranks by pitting moderates from states that Trump won against party leaders and the handful of outspoken liberals considering a run for the presidency.

Andrew Harnik / AP House Speaker Paul Ryan of Wis., center, accompanied by his Press Secretary AshLee Strong, right, walks to the Capitol Building from the Capitol Visitor's Center, Jan. 18, 2018, in Washington House Speaker Paul Ryan of Wis., center, accompanied by his Press Secretary AshLee Strong, right, walks to the Capitol Building from the Capitol Visitor's Center, Jan. 18, 2018, in Washington (Andrew Harnik / AP) (Andrew Harnik / AP)

For one, Republicans attached a long-term extension of the Children's Health Insurance Program and delays to several unpopular health-care taxes. The bill does not include protections for "dreamers," immigrants brought to the United States illegally as children or who overstayed their visas as children, a top Democratic priority.

That represented an election-year bid by the GOP to cast the spending vote as, in part, a choice between poor children and undocumented immigrants. Ryan, McConnell, and other Republicans also sought to highlight the potential erosion to military readiness that could result from a shutdown.

Emboldened Democratic leaders, meanwhile, rallied lawmakers for a showdown on what they believe is favorable ground, fighting on behalf of popular policies against an unpopular president who has had a brutal week of news coverage. As Thursday wore on, undecided senators steadily stepped forward to say that they would oppose the Republican measure - risking GOP political attacks and angry constituents.

Sens. Tim Kaine and Mark Warner, Virginia Democrats who represent tens of thousands of federal employees who stand to be furloughed during a shutdown, said they could not vote for a bill that did not include relief for dreamers, disaster funding, opioid treatment funding and more - echoing the demands of Democratic leaders.

"These issues are not going away and need to be addressed immediately," they said in a joint statement that also criticized Trump: "He has to decide whether he wants to be President and engage in necessary compromise, or continue offering commentary from the sidelines."

Trump fired back at Democrats during a trip to Coraopolis, Pennsylvania, saying that they're pushing for a shutdown to distract voters from the GOP's recent tax legislation. "That is not a good subject for them, the tax cuts," Trump said.

The late-night showdown capped a long, tense day on Capitol Hill that began with a flurry of tweets from Trump that doubled down on his demands for an expensive border wall and accused Democrats of snubbing the military. Another tweet, however, seemed to upend the Republican strategy for avoiding a shutdown and contradict his administration's stated policy position - suggesting that the children's health program ought not to be attached to a temporary spending bill.

Republican lawmakers and aides, who were already pressed to secure enough GOP votes to get the bill through the House, scrambled to decipher Trump's intentions. Much as he had to do a week ago after Trump tweeted about an intelligence bill, Ryan got on the phone with the president to clarify matters, and hours later, the White House confirmed that Trump indeed supported the bill.

The tweets inflamed frustrations in both parties over what they characterized as an all-too-often uncooperative president.

"We don't have a reliable partner at the White House to negotiate with," Sen. Lindsey Graham, R-S.C., said. "This has turned into an s-show for no good reason."

Schumer called Trump and his administration "agents of chaos" who have foiled attempts to reach a bipartisan agreement on immigration, which remained the most salient sticking point Thursday.

"The one thing standing in our way is the unrelenting flow of chaos from the other end of Pennsylvania Avenue," Schumer said. "It has reduced the Republicans to shambles. We barely know who to negotiate with."

Meanwhile, Republican leaders were having trouble smoothing out a wrinkle in their plans to blame a shutdown on Democrats: Hard-line House conservatives demanded concessions in return for their votes, casting doubt on whether the funding patch would even reach the Senate.

All but a few House Democrats said they would not support the bill without an immigration or long-term budget deal.

"If we can't agree, your party has the majority in the House and the Senate to pass your own funding resolution. But that will be a bill we cannot support," 171 of 193 House Democrats wrote in a letter to Ryan on Thursday.

Melina Mara / The Washington Post Speaker of the House Paul Ryan prepares for his press conference on Capitol Hill in Washington, D.C., on Thursday. Speaker of the House Paul Ryan prepares for his press conference on Capitol Hill in Washington, D.C., on Thursday. (Melina Mara / The Washington Post) (Melina Mara / The Washington Post)

While Ryan worked the House floor during an afternoon vote series, trying to lock down votes for the patch, leaders of the hard-right House Freedom Caucus tried to persuade Republicans to withhold their votes.