House Republicans approved legislation Thursday to keep the government running — something they’ve rarely been able to do on their own. The Senate followed suit shortly thereafter, ensuring that a weekend shutdown would be averted.

Most House Democrats refused to support the stopgap measure, which extends government operations through Dec. 22. In a 235-193 vote, only 12 House Democrats voted yes.

In the Senate, the vote was 81 to 14; all opposed were Democrats.

Typically, House GOP leaders, even when they hold the majority, have been unable to pass spending measures without significant support from Democrats. They face problems because Republican deficit hawks often refuse to vote for any legislation that adds to the debt without slashing spending elsewhere, while GOP defense hawks demand more money for the military.

The House Democrats’ move put pressure on House Speaker Paul D. Ryan (R-Wis.) to assemble the votes from his own party.

Congress faced the possible shutdown threat because it failed to approve full government funding at the start of the fiscal year in October. Now another temporary measure will allow negotiations to continue.

Earlier Thursday, President Trump invited Ryan, House Minority Leader Nancy Pelosi (D-San Francisco) and the Senate leaders to the White House to begin outlining the contours of a broader deal to fund the government through fiscal 2018.

“We hope that we’re going to make some great progress for our country,” Trump said at the start of the meeting in the Oval Office.

But Congress faces a time crunch to reach agreement amid broad divisions. Thursday’s vote essentially punts the potential crisis to right before the Christmas weekend.

Republicans, who have the majority in both houses of Congress, are expected to offer another stopgap measure at that time that would keep the government running into January. Leaders hope by then they will have a deal through September.

“We hope we can come to an agreement,” Senate Minority Leader Charles E. Schumer (D-N.Y.) said at the White House. “Funding the government is extremely important. Helping our soldiers is very important and helping average citizens is very important. So we’re here in the spirit of ‘Let’s get it done.’ ”

To pass a government funding bill Thursday without Democrats’ help, Ryan reached a deal with various factions earlier the week to secure the GOP votes.

Under the agreement, the next package, on Dec. 22, would increase military funding through the end of the fiscal year in September 2018 and extend an expiring surveillance program. But it included no fixes for Obamacare and immigration, as Democrats and some Republicans wanted.

It also included a commitment to consider deeper spending cuts in the new year.

To woo Democrats, the next package would also include money for the children’s healthcare program and emergency disaster funds for hurricane and wildfire recovery.

That’s not likely to be enough, though, to win over Democratic votes. Democrats also want a deal to help young immigrant “Dreamers” avoid the risk of deportation as Trump ends the DACA program that allows them to stay and work in the U.S.

And by January, some GOP lawmakers who met with Ryan will now expect to see big spending reductions — likely in welfare-related programs — before passing the final package.

“The defense hawks and the fiscal hawks have come together,” said Rep. Mark Walker (R-N.C.), who helped broker the deal as the head of the conservative Republican Study Committee.

The outcome, though, remains highly in doubt, in part because Republicans cannot yet guarantee they have the votes, and Democrats have not signed off on that deal. Pelosi was withholding the Democratic votes Thursday to extract priorities in the broader talks at the White House.

Even though some Democratic — and an increasing number of Republican lawmakers — have said they will block funding bills unless there is relief for immigrants, Pelosi insisted Thursday they wanted to reach a solution.

“We will not leave here without a DACA fix,” Pelosi said about the Deferred Action for Childhood Arrivals program.

Pelosi said that if the temporary measure does not include any of the priorities they are negotiating for, Republicans will have to pass the bill on their own.

“They either have the votes or they don’t,” she said. “We have been outspoken about what our priorities are.”

The White House meeting came after Pelosi and Schumer backed out of a session last week when Trump tweeted that he saw no deal to be reached with Democrats.

No deal was reached with Trump on Thursday, officials said, but talks will continue.

Trump and GOP leaders made the push for boosting defense funds, evening relocating the meeting to the Situation Room for a briefing from Defense Secretary James N. Mattis.

Republicans want to boost defense spending by $54 billion, avoiding automatic cuts from a previous budget deal, with a $37 billion increase in non-defense accounts. Democrats are making the case for parity.

The White House and GOP leaders also balked at linking the immigration issue to the year-end budget deal.

White House spokeswoman Sarah Huckabee Sanders said they “stressed that negotiations on immigration should be held separately on a different track, and not as part of the government funding bill.”