(CNN) With the tilt of his thumb, Sen. John McCain got the last laugh.

McCain -- with a simple, yet dramatic, thumbs down on the Senate floor in the wee hours of Friday morning -- signaled to the Senate, his colleagues and the rest of the United States that he was not prepared to go along with the latest Republican plan to repeal and replace Obamacare.

After the vote, the 80-year-old senator, who earlier this month was diagnosed with brain cancer, was seen laughing with Sens. Susan Collins and Lisa Murkowski, the two other Republicans who voted against the health care bill.

Trump fumed at the loss, tweeting that the three Republicans "let the American people down," linking them to the Democrats who were uniformly against the plan.

But, more than just a vote in the Senate, the moment was the climactic cap of a years long contentious relationship between McCain, a revered Capitol Hill Republican and former presidential candidate whose recent brain cancer diagnosis rocked Democrats and Republicans alike, and Trump, an unexpected president whose 2015 attack on the Arizona senator was one of the first crises in a campaign full of them.

Trump ran for president, in part, on a pledge to break a mold that McCain fell into. The longtime Arizona lawmaker worked his way up in the Republican Party after years in the United States Navy, representing the state in the House and Senate for over 25 years before he ran for president in 2008.

Trump was anathema to that, making a name for himself as a boisterous real estate developer, reality TV star and political donor before he decided to make the presidency his first foray into public office.

The two men, despite representing the same party eight years apart, are diametrically different. And Trump's animosity for McCain was clear early in his 2016 run.

Sitting before an audience in Iowa in July 2015, Trump argued that McCain, who spent five years as a prisoner of war during the Vietnam War, was not a war hero because he was captured.

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

The comment -- which came after a week of back-and-forth between McCain and Trump, including the Arizona senator telling reporters that Trump was energizing the "crazies" in his party -- was an early inflection point in Trump's campaign. Many Republicans condemned Trump for the comment, including Sean Spicer, who later became the President's spokesman.

McCain, Spicer said, "is an American hero because he served his country and sacrificed more than most can imagine. Period."

Trump's defense of himself over the McCain comment was scattershot. At first, the presidential candidate denied that he ever said McCain wasn't a war hero. Then seemingly justified the attacks by saying he was "disappointed" that McCain has done "very little for the veterans."

Something Trump never did: Apologize.

JUST WATCHED 19 seconds of drama: McCain's vote Replay More Videos ... MUST WATCH 19 seconds of drama: McCain's vote 01:18

An earlier booster of McCain

Trump was a McCain supporter in the early 2000s and endorsed the Arizona lawmaker during his run for president in 2008.

"I've known him. I like him. I respect him. He's a smart guy and I think he's going to be a great president," Trump told CNN months before the 2008 election.

Campaign finance records show Trump had donated to McCain for years before the 2008 run, including giving the legal maximum to his campaign in May 2008. The same month, members of Trump's family -- wife Melania and children Donald Jr, Ivanka and Eric -- also gave McCain the maximum individual donation allowed under federal campaign finance laws.

Their relationship soured after the early support, however, highlighted by Trump questioning McCain's service.

McCain responded to Trump by asking him to apologize to other prisoners of war who he degraded.

"I think he may owe an apology to the families of those who have sacrificed in conflict and those who have undergone the prison experience in serving their country," McCain said at the time. "I'm not a hero. But those who were my senior ranking officers ... those that inspired us to do things we otherwise wouldn't have been capable of doing -- those are the people that I think he owes an apology to."

McCain also declined to attack Trump's lack of military service, despite being prodded to do so in numerous interviews. Trump had multiple student deferments and one medical deferment.

Trump, despite the early controversy, would go on to win the Republican nomination and with it came McCain's hesitant support.

But the Arizona senator rarely held his fire on Trump when the Republican nominee found himself embroiled in controversy.

When Trump questioned a judge's ability to decide a case because of his Mexican heritage, McCain called the comment "very harmful."

And when Trump attacked Khizr and Ghazala Khan, whose son -- Humayun Khan -- was killed by a suicide bomber in Iraq, after their speech at the Democratic National Convention, McCain warned Trump.

"Arizona is watching," he said. "While our party has bestowed upon him the nomination, it is not accompanied by unfettered license to defame those who are the best among us."

When the tape of Trump casually describing sexual assault during a years old interview with Access Hollywood was published by the Washington Post in October, McCain broke with the Republican nominee.

"I have wanted to support the candidate our party nominated," McCain said, nodding to the fact he was a past nominee. "But 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."

Despite Republicans like McCain leaving Trump, the businessman-turned-politician won in November. And so did McCain. The Arizona senator won a sixth term the same day that Trump won the White House, beating Democrat Ann Kirkpatrick in the process.

JUST WATCHED McCain makes plea for Senate to return to order Replay More Videos ... MUST WATCH McCain makes plea for Senate to return to order 01:49

Continues to criticize Trump

The fact that Republicans accepted Trump did little to alleviate McCain's public critiques.

The Arizona senator has called Trump's dealings with Russian diplomats "deeply disturbing," called his plan to hike the Defense Department budget "totally inadequate" and, more recently, called Trump's tweets calling for a ban on transgender service men and women in the military as "unclear" and unnecessary.

Trump's presidency has further cemented the view, in the eyes of Capitol Hill staffers and political watchers, that McCain has never felt beholden to anyone other than voters in Arizona. But his contempt for Trump, these Capitol Hill staffers said, has further caused McCain to embrace the "maverick" nickname he embraced during the 2008 campaign.

Before the Friday morning vote, McCain's cancer diagnosis had given many of his colleagues a chance to herald him and his meaning to the Senate as an institution.

Senate Minority Leader Chuck Schumer, a New York Democrat, called McCain a "true figure," while Sen. Lindsey Graham, a South Carolina Republican and longtime McCain friend, said, "This disease has never had a more worthy opponent."

Trump's response to McCain's ailment was far more passive, and usually framed around how Republicans needed his vote to pass health care.

After McCain had surgery to remove a blood clot above his eye, Trump wished him well at a White House event by calling him "crusty."

"And I can tell you, we hope John McCain gets better very soon. Because we miss him. He is a crusty voice in Washington," Trump said Monday to a smattering of laughs before pausing and adding, "Plus, we need his vote."

After McCain's diagnosis was made public, Trump's written statement called him a "fighter," but his in-person comments focused more on the practical need for his vote.

As Capitol Hill and White House aides worked to move debate in the Senate, McCain returned to the debate and Trump trumped the decision.

"John McCain was great to show up. Big moment. We got the vote," Trump, speaking with service men and women in Ohio, said about a preliminary vote.

By Friday morning, though, Trump may have thought he needed to be careful what he wished for.

"It was," McCain said as he got into a car to head back to Arizona and begin radiation and chemotherapy, "the right vote."