Five years ago, a conservative revolt in Congress led to a 16-day partial government shutdown. Earlier this year, a Senate Democratic protest produced a three-day closure. On Friday, there was a new antagonist from beyond Capitol Hill: President Trump.

As dozens of federal agencies stood on the brink of partially shuttering at midnight, lawmakers in both parties grappled with the jarring dynamic as they raced to strike a last-minute spending deal. The days of presidents trying to head off a chaotic, costly shutdown had given way to a president digging in to secure funding for his border wall — even if it resulted in a shutdown, which was ensured Friday night.

Trump’s defiance — and his role as enabler for conservative insurgents — left a bitter taste for some veteran Republican lawmakers, who nevertheless have largely catered to his whims for two years. His posture has also injected fresh tension into the suddenly shaky relationship between Congress and the White House, which is expected to become rockier when Democrats take control of the House in under two weeks.

“I have a hard time seeing the benefit of shutdown politics ever,” said Sen. Roy Blunt (Mo.), the vice chairman of the Senate Republican Conference. “And maybe the worst of all shutdown politics would be Christmastime shutdown politics. So, that’s my view. And it apparently is not the president’s view.”

The government funding fight could be a preview of other battles to come. A showdown over raising the nation’s borrowing authority is expected to occur sometime in the spring or summer of 2019, raising the possibility of another fierce partisan showdown between the White House and Congress with far-reaching consequences for the fate of the world’s financial markets.

Trump declared last week that he would be “proud to shut down the government for border security,” as he demanded $5 billion to fund a massive wall on the border with Mexico, a signature campaign promise that he repeatedly insisted Mexico would finance.

On Friday, he sought to shift culpability to Democrats. “Shutdown today if Democrats do not vote for Border Security!” he tweeted. Later, he wrote: “The Democrats now own the shutdown!”

But on Capitol Hill, some Republicans were unconvinced by his attempt to deflect responsibility. Sen. Lamar Alexander (R-Tenn.), who is retiring at the end of 2020 after three terms, blamed both Trump and House Minority Leader Nancy Pelosi (D-Calif.) for the standoff.

“A government shutdown should not be part of the budget negotiation any more than chemical warfare should be a part of war. It should be off limits,” Alexander said. “There’s no excuse for talking about a shutdown.”

After Trump’s $5 billion ultimatum last week, Democrats rebuffed him, standing firm behind their counteroffer of $1.3 billion for fencing. The talks were at a stalemate until the White House backed down Tuesday and Trump’s chief spokeswoman said the administration would find “other ways” to fund the wall.

The Senate passed a measure by voice vote on Wednesday that would have extended government funding until Feb. 8, averting a shutdown and effectively punting the debate over the wall into 2019. But Trump, egged on by members of the hard-right House Freedom Caucus, rejected that plan, sending House Republicans scrambling to pass a plan with $5.7 billion for his wall.

Although Senate Majority Leader Mitch McConnell (R-Ky.) agreed to move forward on the bill Friday, it was clear it didn’t have the votes to pass. As the clock ticked toward the midnight deadline for replenishing federal funds, the White House and congressional negotiators went back to the drawing board.

Some attributed Trump’s hardening stance as the week went on to pressure to deliver the wall from prominent conservative media personalities, including Rush Limbaugh.

“This is tyranny of talk radio hosts, right?” said retiring Sen. Bob Corker (R-Tenn.) one of the most outspoken Trump critics in the Republican Party.

“And so, how do you deal with that?” added Corker. “Do we succumb to tyranny of talk radio hosts?”

Corker didn’t have an answer to that question of what Republicans should do as a remedy, even as he questioned whether the party would retain its faith in the president moving forward.

“Are Republicans really going to trust the guy that comes out of the White House on a go-forward basis?” Corker wondered aloud. “I mean, this is a juvenile place we find ourselves at.”

Other Republicans explained Trump’s renewed push for the wall by pointing to the urgency he felt from the conservative base. The pressure is certain to increase closer to the 2020 presidential and congressional elections, especially with Senate Republicans defending 22 seats to Democrats’ 12.

“I think he had thought that he would be able to accept this, but I think once he saw the reaction from the base, I think it strengthened his resolve to try to move forward,” said Sen. Mike Rounds (R-S.D.), speaking of the stopgap bill that passed the Senate by a voice vote. “And unfortunately, that puts us in this position we’ve got right now.”

While it is impossible to know who the public would blame for a shutdown, a Quinnipiac University poll released this week showed that 51 percent of voters would blame Trump and Republicans in Congress more, while 37 percent would blame Democrats in Congress more.

One of Trump’s staunchest allies on Capitol Hill dismissed the notion that they would suffer politically.

“There is not a linear connection to votes at the ballot box,” said Rep. Mark Meadows (R-N.C.), the head of the Freedom Caucus. “I can’t find any correlation between the way people vote and the blame they associate with a shutdown.”

Meadows pointed to the brief January shutdown in which Senate Democrats, led by Minority Leader Charles E. Schumer (N.Y.), tried to use the spending deadline as leverage to gain protections for young undocumented immigrants. The shutdown was not a focal point in the fall midterm elections.

In 2013, Sen. Ted Cruz (R-Tex.) helped lead an unsuccessful effort to stop the Affordable Care Act that led to a more than two-week government closure. Then-President Obama vigorously opposed the move.

Still, Republicans added to their House majority in the next year’s midterms and won control of the Senate.

This time, the threat of a shutdown revolved heavily around one of the president’s core proposals. Democrats, who are fresh off an election in which they gained 40 seats in the House amid a backlash to Trump and his agenda, have signaled they have no reservations about engaging in a protracted political debate over Trump’s wall.

“He said Mexico was going to pay for it. He said it at the rallies,” said Rep. Tim Ryan (D-Ohio) in an impassioned speech on the House floor on Thursday, referencing the president’s campaign promise to compel the Mexican government to finance the wall’s construction.

“And you’re calling us and saying our words are hollow? Are you kidding me?” Ryan screamed.

Even if there are no long-term political consequences for the Trump and the GOP, many Republicans on Capitol Hill were in agreement that shutdown bluster is not a fruitful negotiation tool. Both the 2013 shutdown and the January funding lapse ended without the instigators getting what they sought.

“By and large, the lesson that we’ve learned is shutting down the government, or threatening to do so, is never really good leverage,” said Sen. Marco Rubio (R-Fla.). “But it seems to be happening now pretty frequently.”

Mike DeBonis contributed to this report.