WASHINGTON - Congress voted late Monday to reopen the government after a three-day shutdown, sending President Donald Trump a short-term spending bill that passed after Senate Republican leaders pledged to act on immigration policy next month.

The House joined the Senate in passing the bill to fund the government through Feb. 8, reauthorize the Children’s Health Insurance Program and roll back several health-care taxes. It passed 81-18 in the Senate and 266-150 in the House.

“I’m glad we can finally get back to work here,” Senate Majority Leader Mitch McConnell, R-Ky., said after the vote. He called the shutdown a “manufactured crisis” characterized by “damaging partisan theatrics.”

The breakthrough came Monday after Senate Democrats bowed to pressure to reopen the government, joining Republicans in backing an immigration and spending compromise that was quickly denounced by liberals and immigration activists.

Roughly 60 hours after government funding lapsed, a bipartisan group of negotiators in the Senate prevailed with leadership and trading Democratic support for reopening the government for a commitment by Republicans to hold a vote resolving the status of young undocumented immigrants by mid-February.

Trump welcomed Democrats’ decision to relent and said the administration would “work toward solving the problem of very unfair illegal immigration.”

“I am pleased that Democrats in Congress have come to their senses,” he added in a statement.

But the resolution of the three-day stalemate exposed a growing rift between two groups of Democratic senators: those facing tough reelection campaigns in states Trump won, and those courting liberal voters ahead of possible 2020 presidential bids.

Channeling rage from immigration activists, the possible 2020 candidates were highly critical of their leaders’ willingness to trust that Senate Majority Leader Mitch McConnell, R-Ky., will allow an immigration vote after Feb. 8 if senators cannot strike a deal before then.

“I believe it’s been a false choice that’s been presented” between keeping the government open and resolving the DACA issue, said Sen. Kamala Harris, D-Calif., who voted no. “I believe we can do both.”

A majority of Democrats had forced the shutdown with demands for a vote on legislation to protect Deferred Action for Childhood Arrivals recipients, known as “dreamers,” from deportation after Trump canceled the program. The final bill did not include these protections, nor any specific guarantee of a vote.

Other possible White House contenders who voted against the bill included Sens. Bernie Sanders, I-Vt., Kirsten Gillibrand, D-N.Y., and Elizabeth Warren, D-Mass.

Democratic and independent senators who relented in the standoff said they did not necessarily trust McConnell, but had faith that the bipartisan negotiators, including Sens. Susan Collins, R-Maine, and Joe Manchin, D-W.Va., would force him to abide by his commitments.

“Frankly, our trust is more with our colleagues, that they will hold him accountable,” said Sen. Claire McCaskill, D-Mo., who is up for reelection this year in a state Trump won.

“A commitment this public, with this much fanfare - that’s kind of hard to back away from just three weeks from now,” said Sen. Jeff Flake, R-Ariz., who sided with Democrats on Friday in the vote that produced the shutdown.

Collins, Flake and Sen. Lindsey Graham, R-S.C., helped broker the agreement, with Flake and Graham shuttling between huddles with McConnell and Senate Minority Leader Charles Schumer, D-N.Y., for much of the weekend. During bipartisan meetings in Collins’s office, senators had to use a “talking stick” to avoid unproductive crosstalk. They eventually switched to a basketball, according to Manchin, because it was easier to toss back and forth.

McConnell had said Sunday night and Monday morning that it was his “intention” to take up legislation addressing DACA, border security and other issues if Democrats agreed to fund the government until Feb. 8.

“This immigration debate will have a level playing field at the outset and an amendment process that is fair to all sides,” he said Monday.

The effects of the shutdown over the weekend were relatively muted: halting trash pickup on National Park Service property, canceling military reservists’ drill plans, switching off some government employees’ cellphones.

But the shutdown’s continuing into Monday meant that hundreds of thousands of workers stayed home and key federal agencies were affected. Federal contractors will see payments delayed, and the Internal Revenue Service will slow its preparations for the coming tax season.

Senators did not extract a promise from McConnell that would pave the way for an immigration bill’s passage through the House or its approval by Trump.

Still, some Democratic senators said the deal created the conditions for success.

“You have to be optimistic that we are trusting each other and trusting the process we are putting in place and that over the next 17 days, we will get to a bill that can get a commanding vote in the Senate, not just barely pass,” Sen. Christopher Coons, D-Del., said.

This, combined with legislation to address a bevy of other issues — long-term spending levels, disaster relief and funding for opioid treatment and community health centers — “would create unstoppable pressure on the House,” he said.

Advocates for “dreamers” were less convinced.

Rep. Luis Gutiérrez, D-Ill., blasted his Democratic colleagues in the Senate for shortchanging Latino voters, an increasingly critical voting bloc for the party.

“If the Republicans said we are ending same-sex marriage, but we promise Democrats a vote later; or we approve of oil drilling in every national park, but you’ll have a vote later - do you think the Democrats would say yes? This shows me that when it comes to immigrants, Latinos and their families, Democrats are still not willing to go to the mat to allow people in my community to live in our country legally,” said Gutierrez, one of Capitol Hill’s most vocal advocates for “dreamers,” in a statement.

A top liberal political strategist on immigration issues spoke for many of those in an uproar after the vote.

“We’re p----- off. We’re not naive to the politics. But give me a f-----g break. They do something heroic Friday night they climb down Monday morning,” the strategist said.

Senate Minority Whip Richard Durbin, D-Ill., said he hoped to be “celebrating” with DACA recipients after a possible victory in three weeks.

“To all the ‘dreamers’ watching today: Don’t give up,” he said on the Senate floor. “I know your lives are hanging in the balance.”

The vote to end debate on the spending bill came together quickly after Collins and several other senators said they wanted a firmer, more detailed commitment from McConnell.

“It would be helpful if the language were a little bit stronger because the level of tension is so high,” Collins told reporters outside her office.

A Republican aide involved in the talks said that McConnell and his team were considering putting their plan in document form with more detail as a way of convincing some Democrats to support the short-term bill.

Ahead of the vote to end debate, Schumer warned McConnell to keep his word.

“I expect the majority leader to fulfill his commitment to the Senate, to me and to the bipartisan group, and abide by this agreement. If he does not ... he will have breached the trust of not only the Democratic senators, but members of his own party as well,” Schumer said.

Still, the relief among senators upon reaching a deal was palpable. As the voting began, Schumer shouted from his seated position. “Lindsey! Thank you, my friend,” he said as Graham approached and shook his hand. “We wouldn’t be here without you.”

With the negotiations focused on the Senate, Trump remained on the sidelines for much of the weekend, using Twitter to interject his opinions.

Democrats are acting at the behest of their “far left base” in advocating for “dreamers,” he argued Monday morning.