He caved — for now.

President Trump agreed on Friday to a short-term deal to reopen the government, reversing himself once again after forcing a month-plus government shutdown because Democrats wouldn’t give him money for border wall construction. That marks a major cave for Trump, and a victory for Democrats — especially House Speaker Nancy Pelosi (D-CA), who refused to budge in the face of his demands.

“We have reached a deal to end the shutdown and reopen the federal government,” Trump said in the Rose Garden Friday afternoon. “I will sign a bill to reopen our government for three weeks.”

The agreement, hammered out by congressional leaders, will reopen the government through Feb. 15 and give both sides some time to negotiate a broader deal. It almost completely matches the exact bipartisan deal Trump rejected to force the shutdown in the first place in mid-December, and Republican senators voted at his behest to defeat on Thursday.

Trump’s reversal came on the 35th day of the partial government shutdown, the longest in U.S. history.

A larger potential deal would likely pair border security measures and possible wall funding with Democratic priorities like protections for undocumented immigrants who were brought here as children and refugee groups whose legal status the Trump administration has been threatening. But it’s unclear whether a broader deal is attainable, especially in such a rushed period — and whether a failure could lead Trump to force another shutdown.

Trump didn’t sound conciliatory in his Friday speech, continuing to demand wall funding during a rambling speech in which he repeated his longtime talking points. And he threatened to force another shutdown — or declare a national emergency, as he’s previously threatened — if he doesn’t get a deal to his liking.

“We really have no choice but to build a powerful wall or steel barrier. If we don’t get a fair deal from Congress, either the government will shut down on Feb. 15 again, or I will use the powers afforded to me under the laws and the Constitution of the United States to address this emergency,” Trump warned.

Democrats have previously been open to discussing wall money in exchange for other major concessions on immigration, but refused to negotiate during the shutdown as Trump held federal workers hostage. Heading into the latest round of negotiations they have significantly more leverage following Trump’s failed shutdown strategy — and his threats likely won’t yield any more next time than they did this round.

Trump’s announcement means he got nothing for his shutdown, which forced 800,000 government employees to miss two paychecks and caused major disruptions across the economy. Key workers including TSA and FBI agents, air traffic controllers, Internal Revenue Service and State Department employees, and FDA food inspectors were forced to stay home or work without pay. Trump’s job approval ratings have sunk even lower during the shutdown, while economists warned that the government closure was doing significant and potentially long-term damage to the U.S. economy.

That pressure continued to build in recent days, with New York City’s LaGuardia Airport temporarily shuttering on Friday morning due to staffing shortages.

The offer came a day after a pair of competing bills failed in the Senate, with a number of Republicans defecting to support Democrats’ plan to reopen the government for a few weeks. After the votes failed, there appeared to be a hint of progress, as a bipartisan group of senators started talking about a potential breakthrough on a short-term continuing resolution — before Trump repeated his demand that any deal, even short-term, including wall funding.

This story has been updated to include Trump’s full remarks.