Speaker of the House Paul Ryan, R-Wis., right, shakes hands after presenting a pen to House Ways and Means Committee Chairman Kevin Brady, R-Texas, left, as Senate Majority Leader Mitch McConnell, R-Ky., second from left, watches after signing the final version of the GOP tax bill during an enrollment ceremony at the Capitol in Washington, Thursday, Dec. 21, 2017. (AP Photo/Andrew Harnik)

Speaker of the House Paul Ryan, R-Wis., right, shakes hands after presenting a pen to House Ways and Means Committee Chairman Kevin Brady, R-Texas, left, as Senate Majority Leader Mitch McConnell, R-Ky., second from left, watches after signing the final version of the GOP tax bill during an enrollment ceremony at the Capitol in Washington, Thursday, Dec. 21, 2017. (AP Photo/Andrew Harnik)

WASHINGTON (AP) — The Republican-led Congress narrowly passed a temporary spending bill Thursday to avert a government shutdown, doing the bare minimum in a sprint toward the holidays and punting disputes on immigration, health care and the budget to next year.

The measure passed the House on a 231-188 vote over Democratic opposition and then cleared the Senate, 66-32, with Democrats from Republican-leaning states providing many of the key votes. President Donald Trump is expected to sign the measure.

ADVERTISEMENT

The stopgap legislation would keep the government from closing down at midnight Friday. It has traversed a tortured path, encountering resistance from the GOP’s most ardent allies of the military, as well as opposition from Democrats who demanded but were denied a vote on giving immigrants brought to the country as children and in the country illegally an opportunity to become citizens.

The wrap-up measure allows Republicans controlling Washington to savor their win on this week’s $1.5 trillion tax package — even as they kick a full lineup of leftover work into the new year. Congress will return in January facing enormous challenges on immigration, the federal budget, health care and national security along with legislation to increase the government’s authority to borrow money.

Each of those items is sure to test the unity that Republicans are enjoying now.

“Now it gets down to some very difficult decisions on how we move forward in the first and second quarter of next year,” said Rep. Mark Meadows, R-N.C., a leader of a powerful faction of hard-right Republicans. “There is a lot to do next month. I’m not worried today. I’ll wait until January to be worried, OK?”

Democrats had initially pressed for adding their priorities to the measure, but once rebuffed on immigration they worked to keep the bill mostly free of add-ons, figuring that they’ll hold greater leverage next month.

Among the items left behind was $81 billion worth of disaster aid, which passed the House on a bipartisan 251-169 tally but stalled in the Senate. The measure would have brought this year’s tally for aid to hurricane victims in Texas, Florida, Puerto Rico and other parts of the Caribbean, as well as fire-ravaged California, to more than $130 billion. But both Republicans and Democrats in the Senate want changes, and it was among the items Democrats sought to hold onto for leverage next year.

ADVERTISEMENT

“Democrats want to make sure that we have equal bargaining, and we’re not going to allow things like disaster relief go forward without discussing some of the other issues we care about,” said powerful Senate Minority Leader Chuck Schumer, D-N.Y.

Immigration is among the most difficult issues confronting lawmakers in January, thrust upon them in September after Trump rescinded a Barack Obama order giving these so-called Dreamers protection against deportation, though he gave Congress a March deadline to come up with a legislative solution.

“They embody the best in our nation: patriotism, hard work, perseverance,” House Democratic Leader Nancy Pelosi of California told the chamber’s Rules Committee on Thursday. “We should not leave them to celebrate the holidays in fear.”

Trump and Republicans are pushing for additional border security and other immigration steps in exchange.

“The vast majority of Republicans want to see a DACA solution. They just want to see a DACA solution that’s balanced,” said House Speaker Paul Ryan, R-Wis., referring to the program’s name, Deferred Action for Childhood Arrivals

Also left unfinished were bipartisan efforts to smash budget limits that are imposing a freeze on the Pentagon and domestic agencies, a long-term extension of the popular Children’s Health Insurance Program for 9 million low-income kids and Senate legislation aimed at stabilizing health insurance markets.

“At some point we’ve got to make the hard decisions,” said Republican Sen. John Thune of South Dakota.

Instead, lawmakers struggled to achieve the must-do: a $2.1 billion fix for an expiring program that pays for veterans to seek care outside the Department of Veterans Affairs system; a temporary fix to ensure states facing shortfalls from the Children’s Health Insurance Program won’t have to purge children from the program; and a short-term extension for an expiring overseas wiretapping program aimed at tracking terrorists.

Trump weighed in on Twitter on Thursday morning to offer a boost — and a slap at Democrats.

“House Democrats want a SHUTDOWN for the holidays in order to distract from the very popular, just passed, Tax Cuts. House Republicans, don’t let this happen. Pass the C.R. TODAY and keep our Government OPEN!” Trump tweeted.

Among Republicans, opposition to the temporary measure came mostly from the party’s defense hawks, who had hoped to enact record increases for the military this year and force the Senate to debate a full-year, $658 billion defense spending measure. But that idea was a nonstarter with Senate Democrats, who will only agree to Pentagon increases if domestic programs get a comparable hike.

The short-term spending bill does contain about $5 billion to upgrade missile defenses to respond to the threat from North Korea and to repair two destroyers damaged in accidents this year in the Pacific.

The legislation also has a provision to turn off automatic cuts to many “mandatory” spending programs, including Medicare, that would otherwise be triggered by the tax cut bill. Democrats had sought to highlight the looming spending cuts in arguing against the tax measure.