Image copyright Reuters Image caption The pair clashed frequently before and during Mr Trump's presidency

While John McCain and President Donald Trump were in the same party, their rivalry was bitter.

The Vietnam war hero was one of the most outspoken Republican critics of Mr Trump from the very start of his candidacy.

Mr Trump meanwhile infamously questioned his heroism for being captured in the Vietnam War.

His brief tweet after Mr McCain's death has drawn criticism for failing to directly praise the Arizona senator.

The message was in contrast to glowing tributes from his predecessors Barack Obama and George W Bush.

Here are five key moments that marked a sharp political and personal feud.

1. Trump 'fired up the crazies'

In the summer of 2015, Donald Trump launched his bid to be the Republican Party's presidential nominee with an attack on Mexican immigrants.

"They're bringing drugs, they're bringing crime, they're rapists, and some I assume are good people," he said, to widespread condemnation at the time.

Image copyright Reuters Image caption Donald Trump made the controversial comments while announcing his presidential campaign

This first campaign outing was also when Mr Trump brought up his plan to build a wall on the US southern border.

Mr McCain swiftly denounced the businessman's attacks on immigrants, accusing him of "firing up the crazies" with his views.

2. McCain not 'a war hero'

While the senator may have been the first to fire, Mr Trump was swift to respond.

Less than a month after his Mexican immigrants speech, the reality TV star said at a campaign event in Iowa that Mr McCain was not a war hero.

"He's a war hero because he was captured," he said. "I like people that weren't captured."

Mr McCain was held and repeatedly tortured for five-and-a-half years after his plane was shot down in the Vietnam war.

Image copyright Getty Images Image caption Mr McCain was shot down by the Vietnamese in 1967 and spent years in a prison enduring torture

Mr Trump's nomination rivals condemned his attacks and he eventually rowed his comments back - although he did not apologise.

And Mr McCain did not seek an apology for himself, rather that Mr Trump apologised "to the families of those who have sacrificed in conflict".

But the Vietnam war veteran did respond in a veiled attack, years later criticising those wealthy enough to avoid service in the conflict by finding doctors "that would say that they had a bone spur".

President Trump received five military deferments excusing him from duty in Vietnam during the 1960s - four for academic reasons and one for bone spurs, or calcium build-up in the heels.

3. 'Trump has no excuses'

Once Mr Trump had blown away his challengers for the nomination, Mr McCain came behind the Republican Party's choice.

But just before the 2016 election, a video recording surfaced of Mr Trump making graphic and obscene remarks about women.

In the video, Mr Trump said "you can do anything" to women "when you're a star" and bragged about trying to grope and kiss women.

Media playback is unsupported on your device Media caption A video obtained by the Washington Post shows Republican presidential candidate Donald Trump making lewd remarks about women

Mr McCain swiftly withdrew his support, saying Mr Trump should "suffer the consequences" of his remarks.

"Donald Trump's behaviour make(s) it impossible to continue to offer even conditional support for his candidacy," he said at the time, saying there were "no excuses" and that "he alone bears the burden of his conduct".

"No woman should ever be victimised by this kind of inappropriate behaviour," he said.

4. Thumbs down for Trump's healthcare reform bid

The pair's feud only grew as Mr Trump took office and set to work reshaping the US in his image.

A key campaign pledge for the New York billionaire in 2016 had been to repeal President Obama's landmark healthcare legislation, the Affordable Care Act - known as Obamacare.

Republicans set up numerous efforts to repeal the law, and almost succeeded, needing 50 votes in the 100-seat Senate chamber they control 52-48.

But in a now famous move, as he battled the brain cancer that would take his life, Mr McCain voted no and scuppered the party's bid to undo the act.

Media playback is unsupported on your device Media caption Mr McCain's "no" vote in July scuppered the last Republican bid to repeal Obamacare

President Trump had condemned Republicans who did not back the new legislation, saying: "They don't have the guts to vote for it."

5. 'A US president should not congratulate dictators'

Mr McCain was a prominent Republican on foreign affairs, rising to become chair of the influential Senate Armed Services Committee.

He advocated a strong American presence abroad - so it was no surprise that he chafed at Mr Trump's frequent praise of Russian president Vladimir Putin.

When Mr Putin was re-elected in March, Mr McCain issued a statement strongly criticising the president for congratulating the former spy.

"An American president does not lead the Free World by congratulating dictators on winning sham elections," he said.

Image copyright Reuters Image caption Mr Trump has expressed admiration for his Russian counterpart

He was even more vocal when Mr Trump met Mr Putin in Helsinki this year and said he believed Mr Putin's assessment that Russia did not interfere in his election in 2016 - contradicting US intelligence services.

The former presidential candidate did not mince words.

Mr McCain called the meeting "one of the most disgraceful performances by an American president in memory".

"The damage inflicted by President Trump's naivete, egotism, false equivalence, and sympathy for autocrats is difficult to calculate," he wrote in a statement. "But it is clear that the summit in Helsinki was a tragic mistake."