By 6 p.m. eastern time, hours before the midnight deadline, the best the Senate could do was to agree merely on the scope of 11th-hour negotiations, which would include leaders of both parties and the White House. The goal was a broad agreement that would fund most government agencies for all of 2019 while settling the dispute over border security that has driven the two parties apart.

“There is no path forward for the House bill,” Senator Jeff Flake of Arizona, the retiring Republican and Trump critic, declared on the Senate floor. “The only path forward is to a bill that has an agreement between the president and both houses of Congress. And the next time we vote will be on the agreement, not another test vote.”

Flake and another retiring Republican, Senator Bob Corker of Tennessee, had withheld their support from beginning debate on the bill the House passed, in a bid to jostle the leadership back to the bargaining table. The gambit worked—to a point.

It seemed clear by Friday evening that Congress would miss its deadline, ensuring at least a brief lapse in federal funding. But with talks reopened, it was possible that any shutdown would be short and have a limited impact.

If the negotiations break down again, however, it’s entirely possible that much of the government will remain closed for the rest of the year, until the new Congress convenes in January, with Democrats controlling the House majority.

This is the second government shutdown of the year, after funding lapsed for four days in January as the two parties fought over immigration. But while Democratic demands for a deal that protected Dreamers precipitated that shutdown, the blame for this one will fall squarely on Trump and his demand for a taxpayer-funded border wall.

Earlier in the week, the Senate unanimously approved a measure to keep the government running through February 8; Republicans supported the bill in part because they’d been told Trump was likely to sign it. But the president reversed course, instead heeding calls from hard-liners in the House Freedom Caucus and conservative media to dig in on the wall.

After Trump informed Speaker Paul Ryan in a White House meeting that he would not sign the Senate-passed bill, the retiring GOP leader, in one of his final acts as a member of Congress, bowed to the president’s wishes and added $5.7 billion in wall funding, along with $7.8 billion in disaster relief. The bill passed Thursday evening largely along party lines, as Republicans defied a prediction by House Minority Leader Nancy Pelosi that there were not enough votes for the wall in the House.

It was a pyrrhic victory for Republicans, however. The bill was doomed in the Senate from the moment it passed the House, as Democrats were united in providing enough votes to sustain a filibuster. On Friday, Trump made another futile bid to pressure Senate Majority Leader Mitch McConnell and Senate Republicans to deploy the so-called nuclear option and eliminate the legislative filibuster. But McConnell, as he has repeatedly before, reiterated that he didn’t have enough votes to change the rules.