The partial government shutdown became the longest closure in the history of the United States when the clock ticked past midnight on Friday as President Donald Trump and nervous Republicans scrambled to find a way out of the mess.

A solution could not come soon enough for around 800,000 federal workers who got pay statements on Friday but no pay.

The House and the Senate voted to give federal workers back pay whenever the federal government reopens and then left town for the weekend, as the shutdown entered its 22nd day.

While Trump privately considered one dramatic escape route, declaring a national emergency to build the wall without a new stream of cash from Congress, members of his own party were fiercely debating that idea, and the president urged Congress to come up with another solution.

"What we're not looking to do right now is national emergency," Trump said. He insisted that he had the authority to do that, adding that he's "not going to do it so fast" because he'd still prefer to work a deal with Congress.

With polls showing Trump getting most of the blame for the shutdown, the administration accelerated planning for a possible emergency declaration to try to get around Congress and fund the wall from existing sources of federal revenue.

The White House explored diverting money for wall construction from a range of other accounts. One idea being considered was diverting some of the $13.9bn allocated to the Army Corps of Engineers after last year's deadly hurricanes and floods.

That option triggered an outcry from officials in Puerto Rico and some states recovering from natural disasters and appeared to lose steam on Friday.

Republican Senator Lindsey Graham said in a statement that it was "time for President Trump to use emergency powers to fund the construction of a border wall/barrier". But other Republicans have expressed doubts, given the potential legal hurdles such a move may face.

'Shame on the Senate'

Earlier, on Thursday, federal workers across the country rallied against the shutdown.

At a Washington rally, Richard Trumka, the president of the AFL-CIO, a federation of unions, called the shutdown a "lockout".

"Shame on the Senate. Shame on the White House," he told the crowd. "This lockout has to end, and it has to end now."

In Detroit, federal worker Gregory Simpkins told the Associated Press news agency, "Next week, it's going to be a panic mode. How are we going to pay rent? How are we going to pay out bills? How in the hell are we going to eat?"

In New York, furloughed Park Ranger Kathryn Gilson said if the shutdown goes much longer, it will probably cause her to go into a depression. "I'm kind of just sitting and staring at the wall and trying not to lose my mind," she said.