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

The Senate voted 81-18 for a short-term spending measure, which quickly passed 266-150 in the House.

President Donald Trump signed the bill Monday evening, the final step to ending the three-day shutdown.

Roughly 60 hours after the federal government first shut down, a bipartisan group of negotiators in the Senate prevailed with leadership, 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.

Maine Republican U.S. Susan Collins helped lead a bipartisan group, including Maine independent U.S. Sen. Angus King, who caucuses with Democrats, that worked to end a filibuster of a spending bill that would fund the government through Feb. 8 and reauthorize the Children’s Health Insurance Program for six years.

At a Monday news conference, Collins said the number of more moderate senators who met in her office grew from 17 on Friday to 25 by Sunday. She credited the group with playing “a very instrumental role in breaking the impasse.”

“In the end, I give our leaders a lot of credit for listening to the ideas that we put forward and for showing some flexibility after starting out being pretty dug in,” she said.

The resolution of the three-day shutdown exposed a growing rift between two groups of Democratic senators: those facing tough re-election campaigns in states Trump won, and those courting progressive 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-Kentucky, will allow an immigration vote after Feb. 8 if senators cannot strike a deal before then.

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

Possible White House contenders who voted against the bill included Sens. Kamala Harris, D-California, Bernie Sanders, I-Vermont, Kirsten Gillibrand, D-New York, and Elizabeth Warren, D-Massachusetts.

Democratic and independent senators who relented in the standoff said they did not necessarily trust McConnell, but had faith that the bipartisan negotiators would force him to abide by his commitments.

“I think he has to answer to them if he reneges on this commitment,” King told reporters Monday, “and I think that provides some additional emphasis, if you will, on his responsibility to carry forward on the commitment he made on the floor this morning.”

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 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, Senate Minority Leader Chuck Schumer, D-New York, warned McConnell to keep his word, saying if he doesn’t, “he will have breached the trust of not only the Democratic senators, but members of his own party as well.”

As the impasse continued through the weekend, it was unclear whether the public would blame the Democrats or the Republicans, who control the White House and Congress.

With the negotiations focused on the Senate, Trump used Twitter to interject his opinion. Democrats are acting at the behest of their “far left base” in advocating for “dreamers,” he argued Monday morning.

The effects of the shutdown over the weekend were relatively limited: 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.

BDN writers Michael Shepherd and Christopher Cousins contributed to this report.

Follow the Bangor Daily News on Facebook for the latest Maine news.