The House and Senate early Monday evening approved a bill to end the government shutdown, providing a path forward to reopen federal agencies three days after they were forced to close.

Many Senate Democrats who had withheld their support for a stopgap spending bill on Friday reversed course on Monday, acquiescing to a three-week continuing resolution to fund agencies through Feb. 8 after receiving assurances from Republican leadership to hold votes on their key priorities. Senate Democrats met for more than an hour in a closed-door session earlier in the day before announcing their support for the measure.

The House passed the bill by a 266-150 vote shortly after the Senate approved it 81-18, and was expected to be signed President Trump in short order. The upper chamber approved a procedural vote to move forward with the bill earlier in the day, removing much of the drama about when government would reopen, but took several hours to reach final passage. Part of that delay occurred as lawmakers determined how to ensure no federal employees furloughed on Monday or over the weekend missed their pay. Congress ultimately approved a vehicle to guarantee back pay by unanimous consent.

“That was something we fought very hard for,” said Sen. Chris Van Hollen, D-Md., after the vote. He and fellow Maryland Democrat Sen. Ben Cardin wanted to ensure “all federal employees are held harmless. They had nothing to do with the shutdown mess and they should be fully paid.”

The initial Senate vote came as hundreds of thousands of federal workers in the eastern part of the country were sent home, after reporting to work for a few hours to initiate an “orderly shutdown.” The White House said on Monday it expected all agencies to return to normal working order on Tuesday. In 2013, after agencies closed for 16 days, the Office of Personnel Management and the Office of Management and Budget both issued guidance to agency leaders providing instructions for reopening and spelling out exactly what time various workers should report back to their offices.

Seeing furlough notices hit their constituents’ inboxes and be sent home without pay may have motivated some senators to strike a deal.

“It makes me urgently want to end this,” said Sen. Brian Schatz, D-Hawaii, before heading into the meeting that resulted in Democrats agreeing to vote for the CR. About a dozen Democrats voted against the bill, but Schatz was not one of them.

Even after lawmakers announced a breakthrough on a temporary funding deal, they were pointing fingers for who deserved more blame.

“President Trump’s unwillingness to compromise caused the shutdown and brought us to this moment,” Senate Minority Leader Chuck Schumer, D-N.Y., said on the Senate floor.

Lawmakers still have several issues to sort out before the new CR would expire. Senate Majority Leader Mitch McConnell, R-Ky., said on the Senate floor he would bring to a vote by Feb. 8 at the latest a bill to give permanent legal residency to undocumented immigrants currently under Deferred Action for Childhood Arrivals status. Lawmakers will also work to reach a deal on disaster relief funding and raising spending caps. Democrats have demanded that the caps as set by the 2011 Budget Control Act be raised equally for defense and non-defense spending to ensure their priorities at domestic agencies are funded.

Sen. Angus King, I-Maine, said Democrats have yet to receive any assurances on parity for defense and non-defense spending, but the discussion would be “one of the top issues” in forthcoming negotiations. McConnell on the Senate floor promised only to hold a vote on raising defense spending.

OMB Director Mick Mulvaney said Monday morning he and Trump were focused not on the politics of the shutdown and instead on managing agencies, according to pool reporters at the White House. Trump planned to hold meetings with his Cabinet secretaries throughout Monday to discuss their shutdown procedures.

Schumer faulted Trump for failing to engage in negotiations since Friday, though he said he helped lead to an agreement with his Republican colleagues.

“The great deal-making president sat on the sidelines,” Schumer said.

This story has been updated to reflect the CR's final passage in the House and Senate.