Without some type of funding bill, the failure to agree on a new budget means the US government has technically ran out of money.

Mr Paul later tweeted: "Tonight, you could feel the frustration and embarrassment growing in Congress as we exposed the hypocrisy of Republicans who are joining in an unholy alliance and spending free-for-all with Democrats at the expense of the American people and our party's supposed principles."

He added: "Make no mistake, I will always stand up for fiscal responsibility, regardless of which party is in power, and I will continue to call the Republican Party home to the ideas that led to Americans trusting us with government in the first place."

Two hours after the setback, congressional leaders scrambled to end the standoff in the middle of the night.

Senators eventually voted 71-28 to approve the $400bn (£286bn) budget deal, with the bill moving to the House of Representatives for a further vote.

The bill would hike defence and domestic spending by almost $300bn (£215bn) over the next two years.

Image:Mr Paul (c) poses for pictures during a break from the floor of the Senate

With no plans for other spending cuts or new tax revenues, that additional spending would be financed by borrowed money - something both Democrats and Republicans in the House of Representatives voiced disapproval of.

Four hours after it was given the green light by senators, the bill was approved in the lower chamber too, by 240 to 186 votes.

US President Donald Trump signed the bill, ending the government shutdown.

He tweeted: "Just signed Bill. Our Military will now be stronger than ever before. We love and need our Military and gave them everything - and more. First time this has happened in a long time. Also means JOBS, JOBS, JOBS!"

"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. Must elect more Republicans in 2018 Election!"

The White House had earlier signalled its optimism of the shutdown being short, calling it a "lapse".