US President Donald Trump has signed a bill reopening the country’s government and ending a 69-hour partial shutdown.
Mr Trump’s signature drew to a close a near-three day display of partisan dysfunction after Democrats reluctantly voted to temporarily pay for resumed operations.
They relented in return for Republican assurances that the Senate will soon take up the plight of young immigrant "dreamers" and other contentious issues.
The vote set the stage for hundreds of thousands of federal workers to return on Tuesday, cutting short what could have become a messy and costly impasse.
The House approved the measure shortly thereafter, and Mr Trump later signed it behind closed doors at the White House.
But by relenting, the Democrats prompted a backlash from immigration activists and liberal base supporters who wanted them to fight longer and harder for legislation to protect from deportation the 700,000 or so younger immigrants who were brought to the country as children and now are here illegally.
Democrats climbed onboard after two days of negotiations that ended with new assurances from Senate Majority Leader Mitch McConnell that the Senate would consider immigration proposals in the coming weeks.
But there were deep divides in the Democratic caucus over strategy, as red-state lawmakers fighting for their survival broke with progressives looking to satisfy liberals’ and immigrants’ demands.
Under the agreement, Democrats provided enough votes to pass the stopgap spending measure keeping the government open until February 8.
In return, Mr McConnell agreed to resume negotiations over the future of the dreamers, border security, military spending and other budget debates.
If those talks do not yield a deal in the next three weeks, the Republican promised to allow the Senate to debate an immigration proposal - even if it is one crafted by a bipartisan group and does not have the backing of the leadership and the White House, lawmakers said.
Mr McConnell had previously said he would bring a deal to a vote only if President Donald Trump supported it.
Sixty votes were needed to end the Democrats’ filibuster, and the party’s senators provided 33 of the 81 the measure got.
Eighteen senators, including members of both parties, were opposed. Hours later the Senate passed the final bill by the same 81-18 vote, sending it to the House, which quickly voted its approval and sent the measure on to Mr Trump.
White House press secretary Sarah Sanders predicted that operations would return to normal by Tuesday morning.