WASHINGTON (NYTIMES) - Senate Democrats blinked. But the saving grace for them may be that they did it quickly.
"Should we have ever shut down the government?" asked Senator Joe Manchin III of West Virginia, who played a leading role in finding a way out for Democrats. "Absolutely not."
Over the weekend it became clear that using the shutdown to insist on protections for hundreds of thousands of unauthorised immigrants was a serious miscalculation. By abandoning the strategy on its third day, Democrats believe they limited whatever damage there may be and gave the public time to forget about the disruption before the crucial November election.
They also won a commitment from Senator Mitch McConnell, the Kentucky Republican and majority leader, to allow debate on a wide-ranging, bipartisan measure that could achieve their goal of protecting hundreds of thousands of unauthorised immigrants.
But by supporting the government's reopening, they provoked a surge of outrage from the party's left as progressive activists and lawmakers assailed the deal as a capitulation based on a mere promise by McConnell, a longtime foe known for his obstruction of the Democratic agenda.
Immigration activists were furious that Senator Chuck Schumer of New York, the Democratic leader, and his fellow Democrats had given away the best leverage they had to ensure that the young immigrants were protected.
"It's morally reprehensible and it's political malpractice," said Ezra Levin, the co-executive director of Indivisible, a liberal group.
"Leader McConnell's track record of keeping his 'commitments' is thin at best," said Senator Jeff Merkley, Democrat of Oregon, one of the party's leading progressive voices.
The fierce backlash underscored the challenge confronting Schumer and more centrist Democrats as they attempt to negotiate with Republicans and President Donald Trump to reach an agreement on immigration without alienating the more liberal factions of a party that has moved distinctly to the left.
Their balancing act reflects the broader tension in the party as it tries to reconcile the fervour of blue-state opponents of Trump and the caution of Democrats in states where they must appeal to Trump supporters.
Democrats need to protect 10 Senate Democrats up for re-election in states carried by the president and appeal to the swing voters who could flip control of the House. Those vulnerable Senate Democrats were key to sparking the bipartisan drive to bring the shutdown. Yet many of the Senate Democrats considered potential 2020 presidential candidates voted to keep the shutdown going.
Heading into the showdown, Schumer and other top Democrats figured that Trump was at a vulnerable moment, given the uproar surrounding racially charged comments made in a recent meeting with senators to discuss immigration, disturbing words that came on top of persistent accounts of Oval Office chaos.
And they saw the so-called Dreamers - the young immigrants brought to the United States illegally as children - as a particularly appealing group, as they faced deportation to countries they barely knew through no wrongdoing of their own.
Polling consistently finds deep American sympathy for those immigrants, and under intense pressure from the left to stand tough, Democrats hoped the public would embrace the use of all possible measures to help them.
But over the course of the weekend, Democrats increasingly came to realise they had manoeuvred themselves into a difficult position that made many of the party's moderate senators uncomfortable.
Republicans were not distancing themselves from the president despite his erratic swings on immigration policy. And while the Dreamers may be a highly sympathetic group, using them as a rationale for shuttering the federal government was not playing well.
The president, top Republicans and their allies had some success in framing the showdown as a case of Democrats putting the interests of "illegal immigrants" ahead of US citizens, a line of attack Democrats felt they could not weather.
McConnell, who sat at his Senate desk with a satisfied smile before the vote to reopen the government on Monday, archly drove that point home in brief remarks.
"I think if we have learned anything during this process," he said, "it's that a strategy to shut down the government over the issue of illegal immigration is something the American people didn't understand and would not have understood in the future."
In relenting so rapidly, Democrats saw some tangible benefits. They managed to highlight the plight of the Dreamers while avoiding a prolonged shutdown that could have ultimately damaged their cause. And by conceding defeat on Monday, Democrats avoided widespread disruptions in government operations that would have cascaded during the week and beyond.
They also won the pledge from McConnell to allow broad bipartisan negotiations on immigration, overall spending, health programmes and other unresolved issues. If those fail to produce an agreement by Feb 8, he promised to open an immigration debate on the Senate floor.
Senators on both sides of the aisle saw that as a breakthrough that could provide a chance for the polarised chamber to engage in what has become a rare occurrence: actual legislating.
What they do not have is any certainty that Trump will back whatever legislation the Senate produces or that the House will even consider it.
The agreement to end the shutdown came after weekend negotiations among a bipartisan group of about two dozen lawmakers assembled by Manchin and Senator Susan Collins, Republican of Maine. Members of the group all saw the shutdown as unacceptable and contributing to public disgust with Washington, motivating them to pursue a solution outside the chamber's leadership.
They say they are intent on finding a way to protect the immigrants covered by the Deferred Action for Childhood Arrivals, or DACA, programme as well as fashioning a "global" agreement on spending, disaster aid and a variety of other issues that have defied resolution.
Republican participation in the bipartisan group was crucial for Democrats seeking assurances from McConnell on the way forward. While they were nervous about accepting the word of McConnell given their history of clashes with him, they doubted that he would undercut such a substantial number of his fellow Republicans.
"I expect the majority leader to fulfill his commitment to the Senate, to me and to the bipartisan group and abide by this agreement," Schumer said. "If he does not, of course - and I expect he will - he will have breached the trust of not only the Democratic senators, but members of his own party as well."
Still, immigration activists found fault with putting any faith in McConnell. And they noted that even if the Senate can draft a measure that attracts a broad majority, it faces a steep test in the House, which ignored a 2013 Senate immigration measure that passed with 68 votes.
Negotiations will now begin with Democrats in a new posture. During a Friday meeting with Trump aimed at settling the dispute, Schumer said Democrats would agree to provide significant funding for the wall along the Mexican border that Trump has made a central and symbolic element of his agenda. They had previously opposed any funding for the wall.
While Democrats gave that ground, they are not without weapons. Should the negotiations collapse, they will be able to pound Republicans for abandoning the Dreamers. They could also vote again to shutter the government, though that seems unlikely after this episode.
As lawmakers looked ahead to a few difficult weeks, Republicans chose not to crow over the outcome.
"I think we should be magnanimous," said Senator John Cornyn of Texas, the No. 2 Senate Republican, in what might be the most telling observation about which side prevailed.