US President Donald Trump signed a crucial spending bill Friday, reopening the US government after a brief shutdown, the second in three weeks, and a night of high drama in Congress.
Trump announced the signing on his Twitter account, hailing the bill's passage in the early hours of Friday as a boost for the US military and "JOBS, JOBS, JOBS!"
The House voted 240 to 186 in support of a bipartisan package that extends funding until March 23, hours after a conservative senator forced Congress to miss a midnight deadline, sparking the shutdown.
Senator Rand Paul of Kentucky had blocked a vote in the upper house, briefly bringing the government to a halt to protest big increases in spending on the military and domestic programs.
The compromise approved overnight also leaves many Democrats frustrated by failing to address the fate of hundreds of thousands of young immigrants threatened with deportation.
Trump defended the deal, but said it contained "much waste in order to get Dem votes."
"Our Military will now be stronger than ever before. We love and need our Military and gave them everything -- and more," he said.
"Without more Republicans in Congress, we were forced to increase spending on things we do not like or want in order to finally, after many years of depletion, take care of our Military. Sadly, we needed some Dem votes for passage."
Trump was referring to a provision in the bill that increases spending limits for the next two years and raises the federal debt ceiling until March 2019.
That is set to break the cycle of government funding crises in time for what will likely be a bruising campaign for November's mid-term elections.
But the dramatics in Congress spoke volumes about the political gridlock that defines Washington.
The rebellion that simmered among Republicans and Democrats over the budget agreement boiled over when a determined Paul brought the Senate's work to a halt.
The Kentucky Republican took the floor to blast the increase in federal spending limits, and in particular the fiscal irresponsibility of his own party.
"If you're against president (Barack) Obama's deficits, but you're for the Republican deficits, isn't that the very definition of hypocrisy?" he boomed, adding that he wants his fellow lawmakers "to feel uncomfortable" over the impasse.
Moving legislation swiftly through the upper chamber of Congress requires consent by all 100 members, but Paul objected.
Top Senate Democrat Chuck Schumer warned the delay put lawmakers "in risky territory," and several fellow Republicans confronted Paul in the chamber about his strategy -- but he refused to yield to allow an early vote.
Ultimately, enough members from both parties joined forces to get the temporary spending bill across the finish line, but the bill's fate in the House had been far from certain.
It incorporates a major budget deal reached last week between Senate leaders on both sides of the political aisle.
That agreement includes a $300 billion increase to both military and non-military spending limits for this year and 2019, and raises the debt until March 1 next year.
It also provides a massive $90 billion disaster relief package and funding to address the nationwide opioid abuse crisis.
Several fiscal conservatives in the lower chamber joined Paul in balking at adding billions of dollars to the national debt two months after passing a $1.5 trillion tax cut package.
And liberal stalwarts including top House Democrat Nancy Pelosi were also in revolt because the deal does nothing to protect immigrants known as "Dreamers," who were brought to the US illegally as children, from deportation.
"Nobody wants a shutdown," Pelosi told the House moments before the vote.
She said she wanted an assurance from Ryan that he would take up the issue of immigration in the coming weeks.
"Give us a chance to allay the fear that is in the hearts of these Dreamers and their families, and remove the tears from the Statue of Liberty observing what is happening here," she said.
Democrats have sought to link the funding debate to a permanent solution for the "Dreamers," who were shielded from deportation under an Obama-era program which ended last September by Trump, who set a March 5 deadline for resolving the issue.
The White House's current proposal -- one that would put 1.8 million immigrants on a path to citizenship, but also boost border security, and dramatically curtail legal immigration -- has been panned by Democrats, and several other bipartisan efforts have stalled.