WASHINGTON — House Speaker Paul Ryan said Thursday he’s confident that his GOP-controlled chamber will pass a stopgap government-wide funding bill, even as growing opposition from Senate Democrats made prospects in that chamber increasingly dicey.

President Donald Trump wasn’t helping matters, injecting confusion by tweeting Thursday that a children’s health care program should not be part of a short-term budget agreement. The White House quickly said Trump indeed supports the House GOP measure, which would extend the popular Children’s Health Insurance Program, or CHIP, for six years and keep the government’s doors open through Feb. 16.

The House was to vote later Thursday, and Ryan dismissed speculation that Republican leaders were struggling to assemble the 216 GOP votes they appear to need.

In the Senate, prospects for the House measure dimmed. Virginia’s two Democratic senators, Tim Kaine and Mark Warner, swung against the measure, and Republican Majority Leader Mitch McConnell was pondering fallback options, including a spending bill that would keep the government open for an even shorter period.

Democrats are demanding a deal on legislation to offer protection from deportation to younger immigrants who were brought to the country as children and now are here illegally as a prerequisite for any longer-term government funding agreement. They say the four-week duration of the House continuing resolution is too long and would take the pressure off of immigration negotiations.

“We can’t keep careening from short-term CR to short-term CR. If this bill passes, there’ll be no incentive to negotiate and we’ll be right back here in a month with the same problems at our feet,” said Senate Minority Leader Chuck Schumer, D-N.Y., using Washington shorthand for stopgap funding bills called continuing resolutions. “Eventually, we need to make progress on the biggest issues before us.”

McConnell said that any filibuster by Senate Democrats would pin the blame for a possible shutdown on them.

“My friends on the other side of the aisle do not oppose a single thing in this bill,” said McConnell, R-Ky. “They know they can’t possibly explain to our warfighters and veterans, to our seniors, to our opioid treatment centers, to the millions of vulnerable children and their families who depend on S-CHIP for coverage, or to all the Americans who rely on the federal government for critical services like food inspections and Social Security checks.”

In fact, in the event of a shutdown, food inspections and other vital services would continue, as would Social Security and other federal benefit programs.

Earlier Thursday, Trump briefly upended the measure with an unexpected tweet: “CHIP should be part of a long term solution, not a 30 Day, or short term, extension!”

Just Wednesday, the White House budget office sent Congress a letter expressing support for the overall bill and expressly wrote, “The Administration supports the bill’s multiyear funding extension of the Children’s Health Insurance Program (CHIP).”

White House spokesman Raj Shah added in a Thursday statement that “Congress needs to do its job and provide full funding of our troops and military with a two-year budget caps deal. However, as the deal is negotiated, the President wants to ensure our military and national security are funded. He will not let it be held hostage by Democrats.”

Federal financing for the program that serves nearly 9 million children expired in October and several states are close to exhausting their money, and Congress has passed several short-term patches to keep their programs afloat.

Trump’s comments came amid a flurry of tweets Thursday. He also insisted his views on a border wall with Mexico have not evolved, pushing back against his own chief of staff’s comments to lawmakers.

They also come as lawmakers struggle to reach a bipartisan deal protecting “dreamers” — around 800,000 people who arrived in the U.S. illegally as children and could be deported without legal protections. Part of negotiators’ problem has been uncertainty over what Trump would accept.