Poised to become on Wednesday only the third president in U.S. history to be impeached, President Trump remains remarkably resilient, wounded but not fatally so as he turns toward his 2020 reelection campaign.

Unbowed and unapologetic, Trump is charging through impeachment much as he has wrestled with previous crises in his presidency — attacking his perceived enemies, spinning falsehoods, promising vengeance and firing off tweets, all while cycling between fits of indignation and bouts of confidence and good cheer.

In a fiery and freewheeling six-page letter to House Speaker Nancy Pelosi (D-Calif.) on Tuesday, Trump demonstrated what allies describe as fortitude and critics deride as mania, railing against “an illegal, partisan attempted coup” and a perversion of justice and abuse of power” at the hands of Democrats.

“You have cheapened the importance of the very ugly word, impeachment!” he wrote.

Trump’s ability to exist — and even thrive — amid historic tumult has worried Democrats, who have sought to portray themselves as pursuing somber impeachment proceedings rooted more in duty to the Constitution than partisan politics. Yet that same reality has left many supporters and allies of the president buoyed.

“We’ll just wake up Thursday after this absurd impeachment vote and say, ‘Well, that was quite a Season 3 finale. What’s going to happen in Season 4?’” said Cliff Sims, a former White House aide. “He’s the most resilient politician the country has ever seen.”

Kellyanne Conway, counselor to the president, similarly praised Trump’s ability to “self-resuscitate” and described him as impervious to the head winds that might stagger a less self-assured leader. “He’s someone who sallies forth and soldiers on and gets unusual oxygen from the steepest climbs and most vexing situations,” she said.

Yet Trump also remains the least popular president in modern times, and his impeachment numbers are hardly a triumph. A Washington Post-ABC poll released Tuesday finds support for impeaching Trump at 49 percent compared with 46 percent opposed — views little changed from October — while several recent national polls found his approval rating among registered voters at 43 to 45 percent.

By comparison, a Post-ABC poll in early December 1998 — the same month President Bill Clinton was later impeached — found roughly 2-to-1 opposition to his impeachment.

In swing states that will prove crucial to Trump’s reelection prospects, the outlook is slightly rosier. A Post average of battleground-state polls since October finds that 43 percent support impeachment while 51 percent oppose it. In the critical state of Wisconsin, a Marquette Law School poll in early December found 52 percent saying Trump should not be impeached and removed from office, while 40 percent said he should.

Trump, for his part, is weathering the moment in fits and starts, churning through alternating spurts of anger and optimism.

Aides and allies say that, ultimately, the president does not want to be impeached. He understands its historic import, worries about the stain on his legacy and complains that impeachment is just another attempt by Democrats to undermine his legitimacy and overturn the will of the American public.

Impeachment “only has to do with your attempt to undo the election of 2016 and steal the election of 2020!” Trump wrote in his six-page letter to Pelosi, channeling the aggrieved, almost scandalized tone he has maintained throughout much of the process.

He has been especially frustrated in periods when he has felt there has not been a sufficient outpouring of support from his allies on cable news. During those stretches, he has often tried to snatch control of the narrative with a quick Twitter finger, unleashing scores of tweets and retweets.

Aides and confidants said they expect the president’s Wednesday night political rally in Battle Creek, Mich., to offer Trump a much-needed release valve.

“I fear he’s going to be angry about his legacy, about getting a stain on it,” said one Republican who talked to the president recently, and who spoke on the condition of anonymity to share details of a private conversation. “That’s going to come out during the campaign more.”

In the nearly three months since the start of the House impeachment inquiry, Trump and his allies have taken solace in encouraging bread crumbs they have found scattered along the way.

First, there was the Halloween vote to formalize the inquiry, which House Republicans unanimously opposed. Conway called it “a moment of unity and clarity for President Trump.”

“It’s a diverse caucus of people in blue, purple and red districts, some who are retiring, some who are new, and yet they all came together on one common purpose,” she said.

Then there was public polling on the topic, which plateaued at just under 50 percent in favor of impeaching and removing the president, after an initial surge in support after the inquiry began.

And this week, there was news that Rep. Jeff Van Drew (D-N.J.) is expected to join the Republican Party over his opposition to impeachment — a likely victory for the president that he has touted frequently in private discussions.

Alan Dershowitz, a defense lawyer who has been in recent talks about advising Trump’s legal team, said the expected partisan nature of the outcome has heartened Trump.

“This is the first time in American history a president has ever been impeached along party lines, and that gives the president a sense the impeachment is not legitimate, and that’s important to him,” Dershowitz said.

Carly Fiorina, a former candidate for president who faced off against Trump during the 2016 Republican primaries, exemplified the paradoxes of Trump’s political standing. In an interview with a CNN podcast this week, Fiorina said it is “vital” that Trump be impeached for conduct that is “destructive to our republic” — but also said she was unsure whether he should be removed from office and left open the possibility of voting for him in November.

White House and Capitol Hill aides have expressed happiness — and in some cases, surprise — that Trump has allowed legislative dealmaking to proceed amid the cloud of impeachment, racking up political wins as the year winds down.

So far, the president has also hewed to the wishes of Senate Majority Leader Mitch McConnell (R-Ky.) to accept a shortened impeachment trial in the Senate in January, making it easier for Republicans to try to move on.

In retrospect, Trump’s impeachment seems to have been almost inevitable, though Trump supporters and critics cite different reasons as to why.

The president’s defenders argue that Democrats and Trump opponents have wanted to delegitimize him since the day he took office and point to a long list of offenses, including special counsel Robert S. Mueller III’s Russia probe and subsequent report.

“My impression is that after the Mueller investigation failed, that the base of the Democratic Party was demanding it and there wasn’t a strong enough leadership there from the Democratic side to stop it,” said Marc Short, Vice President Pence’s chief of staff. “I feel like it’s more reflective over where Democratic base politics are and frustration that the Mueller report didn’t lead to impeachment.”

Democrats and the president’s critics, meanwhile, say only Trump himself is to blame. They argue that in pressuring Ukraine to dig up dirt on his political opponents, Trump committed a string of offenses so egregious that they could no longer be ignored.

In some ways, Trump’s impending impeachment and all-but-certain acquittal in the Senate emerge from a perfect storm of political cross currents with a self-sabotaging president at the eye.

Dershowitz likened the dynamic to Clinton’s impeachment two decades prior.

“Clinton’s wife says there’s a ‘vast right-wing conspiracy,’ ” he said. “Okay, she’s right, but what does he do? He plays right into the conspiracy by having sex in the Oval Office with an intern.

“You could say the same thing about Trump,” Dershowitz continued, pointing to a pivotal July 25 phone call between Trump and the president of Ukraine. “He knew they were out to get him, and the phone call gave them an excuse to do it.”

Scott Clement contributed to this report.