US President Donald Trump and Republican lawmakers took a tough stance after the US Congress failed to fund federal agencies, saying they would not negotiate on immigration until Democrats help end the government shutdown.

Funding for federal agencies ran out at midnight with no agreement in Congress, meaning the second year of Donald Trump's presidency began without a fully functioning government.

Lawmakers failed to resolve an impasse over Democrats' demands to include certain measures, including protections for young undocumented immigrants, in any short-term spending legislation.

US government workers were told to stay home or, in some cases, work without pay until new funding is approved in the first federal government shutdown since a 16-day funding lapse in October 2013.

The Republican-controlled Senate and House of Representatives were holding rare weekend sessions, facing a political crisis that could have an impact on congressional elections in November.

"The president will not negotiate on immigration reform until Democrats stop playing games and reopen the government," White House spokeswoman Sarah Sanders said.

Her message was echoed by Republicans in Congress, leading to speculation that Washington could be in for a prolonged battle that has interrupted government services.

Senate Democratic Leader Chuck Schumer gave a stinging portrayal of Mr Trump as an unreliable negotiating partner, saying the two sides came close to an agreement several times only to have Mr Trump back out at the urging of anti-immigration conservatives.

"Negotiating with President Trump is like negotiating with Jell-O," he said. "It's impossible to negotiate with a constantly moving target."

Democrats' demand of securing permanent legal protections for 700,000 young, undocumented immigrants as a condition for new government funding, Republican Greg Walden said, was "hostage-taking in its worse form".

The federal government had been running on three consecutive temporary funding bills since the new fiscal year began in October.

Democrats say they have been pleading with Republicans for months to approve the immigration measure as a stand-alone bill and were rebuffed.

Senate Republican Leader Mitch McConnell said a solution to the crisis was "just inches away" but he blamed Democrats for blocking legislation to pass the stopgap funding measure.

One idea being floated by Republicans was to renew government funding through 8 February to end the shutdown, while working to resolve other issues, ranging from immigration, military and non-military spending levels, disaster relief and some healthcare issues.