President Donald Trump was feeling the heat.
Week after week, Trump had demanded that the government stay partially shuttered until Democrats agreed to pay for his wall along the U.S.-Mexico border. Surrounded by a shrinking cast of advisers, he watched as federal workers went unpaid and basic services were frozen. His poll numbers were slipping. His arguments were landing with a thud with the public.
A pair of Senate votes on Thursday, and a round of telephone calls from frustrated Republicans, made clear he had no way out. A president who never admits defeat then began a rapid retreat.
The story of how Trump reversed himself, ending the country's longest shutdown with little to show for it, is largely one of acceptance. Over 35 days and a critical final 24 hours, Trump finally came to see what many allies had known for weeks about his strategy: His only option was to climb down, at least for now.
So Trump did what he does best, ending one campaign and beginning the next. As soon as this shutdown was about to close, he promised everyone a new fight would begin — and another shutdown could soon follow.
Trump's GOP allies in the Senate had been more than eager to help him get to "yes" on ending Round One. The critical first step was showing that Democrats were not going to buckle.
The White House had maintained there were untold numbers of Democrats ready to bolt from their leaders and back his demand for $5.7 billion in wall money. Yet for weeks, few such Democrats had emerged. Then Senate Majority Leader Mitch McConnell, R-Ky., who had stayed on the sidelines as Trump battled with House Speaker Nancy Pelosi, D-Calif., and Senate Democratic leader Chuck Schumer of New York, agreed to put the theory to a vote.
There would be votes on two plans to reopen the government. The first was backed by Trump; the second by Democrats. The Democrats' bill won more votes than the GOP bill, even though Republicans control the Senate.
It was a harsh, indisputable reality for the president. He recognized something had to give, according to eight people familiar with his thinking who, like others interviewed for this account, spoke on condition of anonymity because they were not authorized to discuss private conversations.
"He knew that it was a lost cause," Schumer said Friday.
Even before the second vote was gaveled shut, McConnell told others he was preparing to reach out to Schumer to talk about what was next. The two met in the majority leader's stately office off the Senate floor. McConnell discussed the offer the White House had proposed: a short-term bill to reopen government that included a "down payment" Trump wanted for the wall.
Pelosi, however, had already waved off the idea, and Schumer said Democrats would not support it, according to a senior Democratic aide. Pelosi had kept her boisterous caucus of Democrats surprisingly united throughout the standoff. She persuaded many that the fight was bigger than any wall.
"That is part of the design, to undo the role of government," she told Democrats on Wednesday, imploring them to hold tough, according to an aide in the room. "There is a plan. It is working for us."
Schumer answered McConnell with the proposal that eventually would be accepted: a three-week measure to reopen the government and then a plan for House and Senate negotiators to discuss border security.
McConnell took the Schumer proposal to the White House. Overnight and into Friday, several Republican senators ramped up the pressure. They called Trump and urged him to end the shutdown and take up border security through the regular legislative process, according to a person familiar with the private conversations.
The White House was ready to consider proposals from Capitol Hill.
Vice President Mike Pence had endured a contentious lunch with Republican senators on Thursday, absorbing criticism for having no plan for a way forward.
Sen. Shelley Moore Capito, R-W.Va., said senators described the "discomfort" of a shutdown and "how fruitless many of us — I'd put myself in that category — think it is."
While the vice president "asked for unity" before the upcoming Senate vote on Trump's plan, he also acknowledged the "need to reach a conclusion," she said.
Stories about federal workers in dire straits due to missed paychecks were weighing heavily, too, on Sen. John Cornyn, R-Texas.
"There's a parade of horribles of how people are having to cope with not getting paid and it's not good," Cornyn said. "There was a lot of frustration expressed about the situation we find ourselves in."
White House aides acknowledged they were running out of options that might minimize the impact of the lengthy shutdown as complaints intensified from government employees and people who depend on federal aid and services. By Friday morning, with airports reporting increased shutdown-related flight delays and more workers recounting their personal financial crises, Schumer and McConnell were on the phone talking details.
At that point, it wasn't hard to persuade Trump.
Pence, senior adviser Jared Kushner and others on his team were seen as supporting an exit strategy. But those close to the White House insisted that Trump viewed this not as a capitulation but rather as one more chance at the deal he wants. Aides said the president believes there are Democrats willing to work on border security and that the bipartisan negotiators on Capitol Hill will draw in a more diverse range of views.
"Will not be easy to make a deal, both parties very dug in," Trump tweeted Saturday, publicly confident of an outcome that has eluded him: "We will build the Wall!