U.S. senators struck a deal on Monday to lift a three-day government shutdown as Democrats agreed to end the standoff in exchange for President Donald Trump's Republicans promising a debate on the future of young illegal immigrants.

Legislation to renew government funding easily won enough support in a vote in the Senate and was expected to pass the House of Representatives, allowing government to reopen through Feb 8.

Most Democratic lawmakers had initially opposed the funding bill, demanding that the Senate also approve protections for young undocumented immigrants known as "Dreamers."

Democratic leaders - worried about being blamed for a disruptive shutdown - accepted a Republican promise to hold a full Senate debate over immigration and the 700,000 Dreamers who were brought to the United States illegally as children.

Trump's negotiations with Senate Democratic leader Chuck Schumer collapsed on Friday into recriminations and fingerpointing and the deal to reopen the government was cut without him.

The Republican president took a new swipe at Democrats as he celebrated.

"I am pleased that Democrats in Congress have come to their senses," Trump said in a statement. "We will make a long term deal on immigration if and only if it's good for the country."

Tens of thousands of federal workers had begun closing down operations for lack of funding on Monday, the first weekday since the shutdown, but essential services such as security and defense operations had continued.

The shutdown undercut Trump's self-crafted image as a dealmaker who would repair the broken culture in Washington.

It forced Trump to cancel a weekend trip to his Mar-a-Lago estate in Florida and created uncertainty around his scheduled trip this week to the World Economic Forum in Davos, Switzerland.

The U.S. government cannot fully operate without funding bills that are voted in Congress regularly. Washington has been hampered by frequent threats of a shutdown in recent years as the two parties fight over spending, immigration and other issues. The last U.S. government shutdown was in 2013.

Both sides in Washington had tried to blame each other for the shutdown. The White House on Saturday refused to negotiate on immigration issues until the government reopened.

On Monday, Trump met separately at the White House with Republican senators who have taken a harder line on immigration and with moderate Democratic Senators Joe Manchin and Doug Jones.

LIBERALS ANGRY

Some liberal groups were infuriated by the decision to reopen the government.

"Today's cave by Senate Democrats - led by weak-kneed, right-of-center Democrats - is why people don’t believe the Democratic Party stands for anything," said Stephanie Taylor, co-founder of the Progressive Change Campaign Committee.

Trump was expected to sign the legislation, which would give Congress more time to try to reach agreement on a long-term spending bill that would resolve issues including immigration, border security and spending caps.

Markets have absorbed the shutdown drama over the last week.

U.S. stocks advanced on Monday as each of Wall Street's main indexes touched a record intraday level after the shutdown deal.

A bipartisan group of more than a dozen senators, led by Republican Susan Collins of Maine and Democrat Joe Manchin of West Virginia, crowded in front of an ornate 19th century clock in a hallway outside the Senate chamber to claim credit for the breakthrough and pledge their interest in overcoming partisan gridlock.

"This represents the first time in a long time that we’ll have the Senate actually functioning, working," said Republican Senator Jeff Flake.

While there was optimism from Senate Democratic leader Chuck Schumer that an immigration bill to protect Dreamers and bolster border security can pass the Senate, it was not clear that the more conservative House would accept such legislation.

In 2013, the Senate passed a bipartisan, comprehensive immigration bill only to see the House, controlled by Republicans, refuse to act.

For Jovan Rodriguez of Brooklyn, a Dreamer whose family came from Mexico when he was three years old and ultimately settled in Texas, the latest development was more of the same.

"Why do we have to wait - again? It's like our lives are suspended in limbo," he said. And they have been for months. I don't trust the Republicans and I don't trust (Senate Majority Leader Mitch) McConnell with just a promise. That's not good enough any more."