President Donald Trump agreed on Friday to fund the government without money for his much-desired border wall, effectively bringing an end to the longest shutdown in American history.

The deal extends funding for the government at current levels until February 15 and include a “vehicle” for lawmakers to begin discussions between the two congressional chambers over a larger bill to fund the Department of Homeland Security and border security specifically.

The president presented the end result as a triumph for his administration, insisting that Democrats had come to his position on the need for a border barrier (they hadn’t).

“After 36 days of spirited debate and dialogue—I have seen and heard from enough Democrats and Republicans that they are willing to put partisanship aside, I think, and put the security of the American people first,” Trump declared on the 35th day of the shutdown.

He added that if money for a “a powerful wall or steel barrier” was not included in a deal three weeks from now, he would shut down the government again or use emergency powers to build the wall himself—a threat he had issued several times already.

Though Trump spoke defiantly, the consensus view from officials of both parties on Capitol Hill was the Trump’s clock had been cleaned. The president had insisted to House Speaker Nancy Pelosi (D-CA) that he would not sign any bill to open the government that did not include $5.7 billion in wall funding. But amid sagging poll numbers and partial closures of critical government functions—including, on Friday morning, flights in and out of LaGuardia Airport in New York—Trump committed on Friday to doing just that.

At a joint press conference after the speech, Pelosi and Senate Minority Leader Chuck Schumer (D-NY) took a victory lap, shielding the White House and congressional Republicans and thanking the federal workers who worked more than a month without pay.

“Shutting down the government over a policy difference is self-defeating,” Schumer said. “It accomplishes nothing but pain and suffering for the country and incurs an enormous political cost to the party shutting it down.”

“It’s sad that it’s taken this long to come to such an obvious conclusion,” Pelosi added.

Pelosi dismissed several questions about whether the president has underestimated her ability to hold firm to her position — instead praising the unity of the Democratic caucus.

But it clear who was in charge when asked whether the State of the Union was going to go on as initially planned on Jan. 29.

“The State of the Union is not planned,” Pelosi said. “What I said to the president is when the government is open we will discuss a mutually agreeable date.”

Schumer, however, was less hesitant to praise Pelosi’s prowess.

“No one should ever underestimate the speaker as Donald Trump has learned,” he said.

The president’s cave was not lost on Senate Republicans who filed out of a closed-door meeting in the Capitol after the speech concluded.

“ Everyone is relieved that the government is getting back open but I think everyone is still a little tenuous because we still have a sword of Damocles hanging over us three weeks from now,” he said.

Asked if the 35-day shutdown was worth it, Lankford said, “I think time will tell, honestly, I assume we’ll find out in the days ahead once we have the negotiations. “

Sen. Rob Portman (R-OH) predicted an “intense three week period of negotiation” but was optimistic that something would ultimate be hammered out before funding ran out again, noting that bipartisan groups of lawmakers have already been talking behind the scenes.

Still, he too wasn’t ready to say the ends justified the means.

“I’m not a shutdown fan,” he said. “We’ll see what happens.”

The resolution seemed destined to provide only a brief reprieve from the political acrimony that has paralyzed Washington in recent weeks as it would only last three weeks. At a lunch briefing with reporters and columnists on Friday, Pelosi said she felt optimistic that there would not be a shutdown again, owing to the likelihood that Trump will have recognized how politically damaging the current standoff had been.

“The point was to make sure he doesn’t see this is an option that he can cavalierly use,” she explained. “So I think it makes it less likely.”

Pelosi was also critical of Republican lawmakers for letting the situation get to its current point. In particular, she singled out Senate Majority Leader Mitch McConnell (R-KY), who had insisted it was pointless to move any government funding measure through the Senate if Trump had not committed to signing it—including reintroducing a clean funding bill that the Senate had overwhelming backed in December.

“I know he is a professional,” Pelosi said of McConnell. “So It is particularly painful to see him kowtowing to the president of the United States. And I said to him, ‘Do you just want to abolish the Congress or maybe just the United States Senate? Because that is effectively what you’re doing.’”

Asked what McConnell said in response, Pelosi replied: “What does he ever say? Nothing.”

An aide to McConnell told The Daily Beast that, “The Leader has given numerous speeches on how a bill becomes law. One of those components is a presidential signature. That’s in the Constitution.”

The majority leader did ultimately end up relenting on that pledge. On Thursday afternoon, he brought two bills to the floor. A Republican-backed bill that would have reopened the government—which included Trump’s wall money, some concessions on DACA designed to woo Democrats, and new asylum restrictions that made the bill a nonstarter—won the support of only one Democrat, Sen. Joe Manchin (D-WV).

A Democratic bill that would have reopened the government until February 8, meanwhile, fell short of 60 vote threshold needed for passage in the Senate but came out ahead of the Trump-backed bill. Six Republicans crossed the aisle to vote for the Democrats’ stopgap measure, including Sen. Mitt Romney (R-UT) and Sen. Susan Collins (R-ME).

Shortly after the votes failed, McConnell met with Senate Minority Leader Chuck Schumer to hash out a deal, their first such meeting in weeks. Sen. Lindsey Graham (R-S.C.), who has the president’s ear, had been pushing for a short-term spending bill for a week and called for Senate leaders to move on it quickly.

White House sources had told The Daily Beast on Thursday that they were “stuck” in the shutdown impasse. But on the Hill, talks began in earnest, with lawmakers no longer eager to simply wait to see what the president might find agreeable and Republicans, in particular, growing increasingly anxious with how long the government had been closed.

“Let me tell you a little history of myself, in 1995 I thought the shutdown was the greatest thing since sliced bread, and you know what I’ve found out since then?” said Sen. Chuck Grassley (R-IA). “It costs money to shut down the government, it costs money to open government; it’s not a wise thing to do.”