Sen. John McCain (R-Ariz.). (ASTRID RIECKEN/EPA-EFE/REX/Shutterstock)

This post was originally published in 2017 and has been updated.

There are decades worth of stories about the political career of Sen. John McCain (R-Ariz.) that have nothing to do with President Trump. But as we remember the senior senator, who died Saturday at 81 after being diagnosed with brain cancer, it’s undeniable that McCain played an outsize role in Trump’s campaign and presidency. At first he was reluctantly pulled into it, but in the last year of his life, McCain was leading the battle for the soul for the Republican Party.

Let's start from the beginning. Barely a month into then-candidate Donald Trump's presidential run, McCain almost inadvertently ended it. Or so many thought.

“He’s not a war hero,” Trump said. “He’s a war hero because he was captured. I like people that weren’t captured, okay? I hate to tell you. He’s a war hero because he was captured, okay?”

Well, that was it. You can't disparage a war hero who has become a living legend in Washington and expect to win the Republican presidential nomination.

McCain said he was “surprised” Trump went after him but referred to a famous Theodore Roosevelt quote about the difference between talkers and doers. “I'm in the arena, as T.R. used to say.” In other words: Trump ain't nothing to me.

He soon would be. Trump won the Republican nomination. And McCain, whether he wanted to or not, would go on to play a central role in the rest of Trump’s political narrative, a symbol of the establishment Republican Party that Trump stomped on to snatch victory.

McCain may not have liked the guy (he questioned his fitness to be commander in chief), but like most dutiful Republicans, he respected what Trump had done. He endorsed Trump for president.

The decision would test McCain many more times. Weeks later, Trump battled a Gold Star parent who spoke at the Democrats' nominating convention. McCain was fuming.

“I cannot emphasize enough how deeply I disagree with Mr. Trump’s statement,” McCain's Senate campaign said in a statement. “I hope Americans understand that the remarks do not represent the views of our Republican Party, its officers, or candidates.”

Trump predictably didn't like that. He told The Washington Post that he might or might not support McCain, who was running for a sixth term in the Senate, in his primary. He said he had no interest in apologizing to McCain for the war hero spat.

Trump's threat to undermine McCain, among other GOP leaders, would later be remembered as a giant middle finger to the Republican Party that had just swallowed its pride and given him the nomination.

At this point, McCain's Democratic opponent was running ads tying McCain to Trump's most controversial comments about immigrants and women.

And the rest of us were asking: How in the world is McCain still supporting Trump anyway?

(Because, politics, surmised The Fix's Aaron Blake: “If McCain wants to be renominated, it's perhaps best not to alienate the many Arizona Republicans that backed Trump and turn this into a Trump vs. McCain primary.")

McCain did win that primary. Literally a day later, he ditched Trump. Given that McCain had gritted through Trump’s pummeling for more than a year without saying much, it was a high-profile defection.

In a gauzy, five-minute video, he basically acknowledged that he thought Hillary Clinton was going to win and pitched himself as a bulwark against a Democratic president.

“If Hillary Clinton is elected president, Arizona will need a senator who will act as a check — not a rubber stamp — for the White House,” he said.

Once again, McCain didn't get what he wanted. Trump is now President Trump.

But both safely elected and back in Washington, McCain let his true colors fly. He became Trump's chief Republican antagonist in the Senate.

Shortly after Trump got elected, McCain was one of the first GOP senators to express reservations about Trump’s Cabinet nominees. When “pigs fly,” McCain said when asked if he would support Rex Tillerson for secretary of state. (He eventually did but since said he sometimes regrets it.)

McCain was one of the first senators of either party to demand an independent investigation into Russia meddling.

Last summer came the moment Trump will never forget. After announcing his diagnosis of brain cancer, McCain gave a surprise "no" vote that ended Republicans' efforts to repeal Obamacare. Trump has brought up that "no" vote every chance he gets.

McCain used his last few months in Washington to deliver series of speeches with increasingly alarmist language about Trump.

"We're getting nothing done," he scolded his colleagues on the Senate floor.

“We have to fight [against Trumpism],” McCain told Naval Academy midshipmen, describing Trump’s foreign policy as nothing more than “crackpot conspiracy theories.”

“We are not his subordinates,” he warned his party in an op-ed, referring to the president.

At the end of 2017, McCain left Washington for treatment of his cancer. But even from his home in Arizona, he continued to poke Trump where it hurt. At a critical moment this spring when Trump’s CIA nominee was on thin ice to get approved by the Senate, McCain publicly engineered a bid to try to tank her confirmation by urging his colleagues to vote against her.

The last major public spat between the two was ugly. Trump and his White House refused to publicly apologize for a crude comment a former aide made about McCain’s imminent death. McCain’s daughter, Meghan McCain, said people who defend that aide “are going to have to answer for their own conscience.”

McCain's last defiant act of the Trump era was to write a book. It was a memoir that mourned for a time past in politics and compared Trump to a despot.

“I would like to see us recover our sense that we are more alike than different,” he wrote. “Even in times of political turmoil such as these, we share that awesome heritage and the responsibility to embrace it.”

In the beginning, McCain was caught off guard by how Trump's nascent and chaotic presidential campaign sucked him into the center of its vortex. He wrote in his memoir that he didn't know what to make of Trump's convictions.

In the last year of his life, McCain transformed himself into a willing leader of the resistance.