President Donald Trump's acrimonious relationship with Arizona Republican Sen. John McCain has been one of the defining features of his presidency so far.

In remarks that started percolating on the campaign trail and have persisted in the years since, Trump has criticized the former presidential nominee, focusing on his military service and the time he spent as a prisoner of war in Vietnam. Once he took office, the president targeted issues McCain voted on that opposed his policies –- and continued blasting McCain even after his brain cancer diagnosis.

Trump’s fixation on the former presidential nominee seemed to begin well before he came to Washington. Back in 1999, Trump insulted McCain’s military service, a foreshadowing of his message on the campaign trail.

“He was captured. Does being captured make you a hero? I don’t know. I’m not sure,” Trump said in an interview with Dan Rather that year.

More than 15 years later, Trump reprised that broadside shortly after announcing his presidential bid.

“He’s not a war hero. He’s a war hero because he was captured. I like people who weren’t captured,” Trump repeated in 2015.

In 1967, after McCain’s bomber was hit, the then-Navy pilot ejected himself and was captured by North Vietnamese combatants. McCain was imprisoned for five years, underwent torture and refused to be released early unless every man captured before him was also set free.

The effects of the injuries from his ejection, torture and inadequate medical treatment left him permanently incapable of raising either arm above his shoulders.

Besides McCain’s military service, the other major line of attack, which Trump kept as part of his stump speech after the senator announced he was diagnosed with glioblastoma, was on his vote against the Republican proposal to repeal and replace the Affordable Care Act, or Obamacare.

McCain flew back from Arizona, where he was already receiving treatment, in July 2017, and delivered a body blow to the bill by brandishing a dramatic thumbs down -- the third and last Republican needed to sink the legislation -- during the vote on the so-called “skinny repeal” bill.

It seemed to blindside the president, who he earlier had tweeted with the apparent assumption that McCain was returning to Washington to help pass the bill.

Since then, Trump has made McCain’s no-vote a signature attack line in nearly every campaign speech, though never referring to McCain by name. His most recent use of this attack was in West Virginia, just three days before the McCain family announced he was stopping treatment, and only four days before the Arizona Republican died.

“I will tell you [Obamacare] is being chipped away. We had it beaten, but one man, I'm sure nobody knows who I'm talking about, voted no, shockingly. To -- really surprising to a lot of people because he campaigned on repeal and replace -- but we've really knocked it out, including the individual mandate,” Trump said.

These types of remarks were frequently met with boos and jeers from the audience.

And the negativity directed at McCain seemed to trickle down through the rest of his White House. In May, a White House official, Kelly Sadler, remarked in a closed-door meeting that McCain’s opinion of CIA director nominee Gina Haspel didn’t matter because “he’s dying anyway.”

Those comments earned sharp rebukes from McCain’s family, including his wife Cindy on Twitter.

Sadler left her position a short time later.

For his part, McCain largely refrained from the type of personal attacks that Trump delivered against him, but on at least one occasion he referred to the type of draft deferment that allowed Trump to avoid military service during the Vietnam War.

In an interview with C-SPAN about the Vietnam War that aired in October 2017, McCain lamented the ability of wealthy Americans to avoid military service, putting the burden on poor people.

“One aspect of the conflict, by the way, that I will never ever countenance is that we drafted the lowest-income level of America, and the highest-income level found a doctor that would say that they had a bone spur,” McCain said during the interview. “That is wrong. That is wrong. If we are going to ask every American to serve, every American should serve.”

President Trump received at least one deferment from the draft because of a doctor’s letter citing bone spurs, an ailment he later described as “not a big problem, but it was enough of a problem.”

McCain later explained that he didn’t consider Trump to be a draft dodger and that his remarks had simply been a comment on how “the system was so wrong that certain Americans could evade their responsibilities to serve the country.” But most of McCain’s critiques of the president were directed at his policies, tone and use of executive power.

The day after his landmark health care vote, McCain delivered a powerful speech on the Senate floor in which he touted the Senate’s role as a check on presidential power and the need for civility.

“I hope we can again rely on humility, on our need to cooperate, on our dependence on each other to learn how to trust each other again and by so doing better serve the people who elected us.

Stop listening to the bombastic loudmouths on the radio and television and the Internet. To hell with them. They don’t want anything done for the public good. Our incapacity is their livelihood,” he said.

“We are an important check on the powers of the Executive. Our consent is necessary for the president to appoint jurists and powerful government officials and in many respects to conduct foreign policy. Whether or not we are of the same party, we are not the President’s subordinates. We are his equal!” he continued.

In his final public speech, accepting an award in Philadelphia last year, McCain once again seemed to call out Trump's style of politics without mentioning the president by name.

"To fear the world we have organized and led for three-quarters of a century, to abandon the ideals we have advanced around the globe, to refuse the obligations of international leadership and our duty to remain ‘the last best hope of Earth’ for the sake of some half-baked, spurious nationalism cooked up by people who would rather find scapegoats than solve problems, is as unpatriotic as an attachment to any other tired dogma of the past that Americans consigned to the ash heap of history,” McCain said.

McCain also slammed Trump after the president feuded with Rep. Frederica Wilson, D-Fla., after she read out a conversation between Trump and the widow of Sgt. La David Johnson, a soldier killed in Niger. Wilson claimed Trump had told Johnson’s widow that he “knew what he signed up for.”

Trump had publicly refuted Wilson and disputed her accounting of the conversation, calling it “totally fabricated.”

In response, McCain said during an appearance on "The View": “We should not be fighting about a brave American who lost his life serving his country. That should not be the topic of discussion in America today.”

McCain likely also drew the president’s ire when he passed along a copy of the so-called “dossier” of potentially damaging allegations about Trump to FBI Director James Comey, which he acknowledged doing in January 2017.

In his book “The Restless Wave,” McCain described why he decided to share the document with the FBI.

“The allegations were disturbing, but I had no idea which if any were true. I could not independently verify any of it, and so I did what any American who cares about our nation's security should have done," he wrote. “I did what duty demanded I do.”

Even after he departed Washington for treatment at home in Arizona, McCain issued often withering commentary on some of the president’s policy decisions, especially when it came to relations with foreign nations -- though he also applauded Trump when he felt he deserved it.

After the president’s press conference with Russian President Vladimir Putin, in which he cast doubt on the U.S. intelligence community’s assessment that Russia interfered in the 2016 election, McCain issued a scathing critique.

“Today’s press conference in Helsinki was one of the most disgraceful performances by an American president in memory. The damage inflicted by President Trump’s naiveté, egotism, false equivalence, and sympathy for autocrats is difficult to calculate. But it is clear that the summit in Helsinki was a tragic mistake,” McCain said in part.

“No prior president has ever abased himself more abjectly before a tyrant,” the statement continued.

McCain, who was serving as the chairman of the Senate Armed Services Committee, was also deeply critical of Trump’s summit with North Korean leader Kim Jong Un and his suspension of joint military exercises between the U.S. and South Korea, calling the latter “a mistake.”

“Making unnecessary and unreciprocated concessions is not in our interests -- and it is a bad negotiating tactic. Parroting Chinese and North Korean propaganda by saying joint exercises are ‘provocative’ undermines our security and alliances,” he wrote.

Even though Trump started targeting McCain well before he earned the Republican Party’s presidential nomination, McCain did not withdraw his support for him until the infamous Access Hollywood tape, in which Trump made lewd remarks about women, surfaced in October 2016.

McCain announced he would not be voting for Trump, despite his desire, he said, to remain loyal to his party by supporting its nominee.

“Donald Trump's behavior this week, concluding with the disclosure of his demeaning comments about women and his boasts about sexual assaults, make it impossible to continue to offer even conditional support for his candidacy,” McCain said in a statement.

He later said he was considering writing in the name of his good friend Sen. Lindsey Graham, R-S.C., who ran his own presidential campaign that year.

True to form, Trump responded by lashing out on Twitter.

“The very foul mouthed Sen. John McCain begged for my support during his primary (I gave, he won), then dropped me over locker room remarks! — Donald J. Trump (@realDonaldTrump) October 11, 2016

As McCain continued to battle his illness, observers in Washington thought the president might pay tribute to him in mid-August by mentioning him in connection with this year’s annual military policy bill, which was named the John S. McCain National Defense Authorization Act for Fiscal Year 2019 in his honor.

But Trump did not mention McCain by name, either at an event highlighting the bill this month or at the bill’s June signing ceremony, where he did thank other members of Congress who were present.

Despite his refusal to engage Trump, McCain sent a powerful message by rebuking the president with one of his final decisions inside the Beltway. While Vice President Mike Pence will be invited to McCain’s funeral service at the National Cathedral in Washington, Trump, according to the New York Times, will not.