He was 81.
McCain's daughter Meghan posted a tribute to her father on Twitter shortly after his death, saying she was with him "at his end as he was with me at my beginning."
"My father is gone, and I miss him as only an adoring daughter can," she wrote. "But in this loss, and in this sorrow, I take comfort in this: John McCain, hero of the republic and to his little girl, wakes today to something more glorious than anything on this earth. Today the warrior enters his true and eternal life."
McCain was the admiral’s son who refused an easy out from a Vietcong prison, enduring torture rather than abandoning his friends.
Two images of McCain, taken 50 years apart, bookend his journey.
One is of a 31-year-old Navy pilot, son of a four-star admiral, lying in agony in a Hanoi prison, his arms and legs broken when his plane was shot down, refusing the offer of an early release out of loyalty to his fellow prisoners. McCain spent five years as a prisoner of war, was placed in solitary confinement and tortured, and carried the injuries for the rest of his life.
In an interview in 2007 with ABC News' Terry Moran, McCain reflected on those years.
“I was privileged to serve in a company of heroes. I’ve observed a thousand acts of courage, and compassion and love,” McCain said. “And what I really found out that I wasn't dependent on myself alone. That I was dependent on others. I was a pretty arrogant, young Navy pilot. I found out that it was my comrades and my leaders who picked me up when I was down. I found out that I was human.”
The second enduring image is of an 81-year-old senator, already suffering from the aggressive brain cancer that would claim his life, stretching out that war-injured right arm, thumb down, to kill his party’s last-ditch attempt to repeal Obamacare. McCain was no friend of the Affordable Care Act, but felt that the Republican bill would have exploded the deficit, and cast the deciding vote on principle.
McCain had just been diagnosed with glioblastoma, an aggressive and usually lethal brain tumor. The vote would be his final act of defiance against his own party, and against President Donald Trump, whom he held in open contempt.
The enmity between the two men carried on into 2018, this time over another of McCain’s passions — his intense dislike of Russian President Vladimir Putin.
After Trump congratulated Putin on his election victory, McCain scolded the president in a tweet, writing: "An American president does not lead the free world by congratulating dictators on winning sham elections.”
The bad blood goes at least as far back as 2015, when Trump, who avoided Vietnam because of foot issues, disparaged McCain’s service.
“He’s not a war hero,” said Trump at a forum in Iowa. “He was a war hero because he was captured. I like people who weren’t captured.”
"If I took offense at everybody who has said something about me, or disparaged me or something like that. Life is too short. You've got to move on," McCain told CBS’ "60 Minutes" in his final TV interview last October.
"He is in the business of making money and he has been successful both in television as well as Miss America and others. I was raised in a military family," McCain said, drawing a contrast both charitable and pointed. "I was raised in the concept and belief that duty, honor, country is the lodestar for the behavior that we have to exhibit every single day."
By his own admission, McCain’s long career has been marred by a few less-than-honorable chapters.
His father and grandfather both graduated from the U.S. Naval Academy in Annapolis, both men going on to become four-star admirals. McCain went, too, but barely made it out, earning a reputation as a partier, a less-than-diligent student. He graduated fifth from the bottom of his class.
After Vietnam, McCain’s marriage to his first wife, Carol, fell apart.
"My marriage's collapse was attributable to my own selfishness and immaturity more than it was to Vietnam, and I cannot escape blame by pointing a finger at the war,” he told The Arizona Republic. “The blame was entirely mine."
In the 1980s McCain, along with four other senators, was accused of trying to help a wealthy donor, savings and loan owner Charles Keating, hold off federal regulators.
“I would very much like to think that I have never been a man whose favor could be bought,” he wrote of the scandal in his 2002 book “Worth the Fighting For.” “Yet that is exactly how millions of Americans view me for a time, a time that I will forever consider one of the worst experiences of my life.”
In 1983, McCain voted against making Martin Luther King Jr.'s birthday a national holiday, a position he renounced in his 2008 presidential run.
"We can be slow as well to give greatness its due, a mistake I myself made long ago when I voted against a federal holiday in memory of Dr. King. I was wrong," he said in 2008. "I was wrong, and eventually realized it in time to give full support — full support — for a state holiday in my home state of Arizona."
But in the crucible of that campaign McCain’s sense of honor also shone. In August, with the campaign still neck and neck, McCain publicly denounced a conspiracy theory about Obama at a town hall in Pennsylvania.
A woman in the audience told McCain she couldn’t trust Obama because "he's an Arab."
"No, ma'am," McCain said. "He's a decent family man, a citizen that I just happen to have disagreements with on fundamental issues, and that's what this campaign is all about. He is a decent person and a person that you do not have to be scared of as president."
That reaction drew applause from the partisan audience, and exemplified the senator.
"John McCain was a hero, an American hero, a patriot. John McCain was not a saint," ABC News Chief Anchor George Stephanopoulos said. "He was a man with a vivid, vivid temper. He got angry at Barack Obama. He was angry at Barack Obama through much of that campaign, through his early days as a senator when he thought Barack Obama was too much of an upstart as he came into the Senate -- looking beyond the Senate toward the White House. But he had a deeply rooted sense of decency and character and he was aware of his own weaknesses and aware of when he might get carried away and when he knew that he had to calm things down and that was what we saw in that moment.
"He knew that there were lines in politics that you could not cross, even when you were angry, even when you lost your temper, even when you were running for the highest office in the land," Stephanopoulos added. "He demonstrated that again and again and again."
Last July, Obama joined the outpouring of affection for McCain that followed the revelation that he was suffering from a deadly cancer.
"John McCain is an American hero & one of the bravest fighters I've ever known," Obama tweeted. "Cancer doesn't know what it's up against. Give it hell, John."
On Saturday, Obama released a statement saying that he and McCain, for all their differences, shared a "fidelity to something higher — the ideals for which generations of Americans and immigrants alike have fought, marched, and sacrificed."
"Few of us have been tested the way John once was, or required to show the kind of courage that he did," Obama said in the statement. "But all of us can aspire to the courage to put the greater good above our own. At John’s best, he showed us what that means. And for that, we are all in his debt."
McCain never shied away from a fight in his career in politics either.
"As he said, 'A fight that you don't join is a fight that you don't enjoy' -- so John McCain was no namby-pamby," Moran said. "He liked to get in the trenches and slug it out, in a way that was quintessentially American."
Over the course of his extraordinary political journey, McCain also forged deep friendships, especially with South Carolina Republican Sen. Lindsey Graham.
"I can't think of anything I've done since 1999 politically, in many ways personally, that was worth doing without John," Graham said in July. “He loves his family. He loves his friends. But his passion above all else is his passion for his country."
But McCain’s personal affections were never partisan. Among his close friends were Connecticut’s Joe Lieberman, Massachusetts Sens. Ted Kennedy and John Kerry and former Vice President and Delaware Sen. Joe Biden.
"I was lucky to know him and work with him and am comforted now by great memories of our times together and by the words he spoke to me last summer when he was recovering from the brain cancer surgery: 'I want to live as long as I can but if my life ends soon as a result of this cancer, I will have been blessed to have lived a great life. So I am going to go forward with a lot of gratitude and joy every day I can,'" Lieberman recalled in a statement.
Biden issued a statement Saturday saying he, America and the world would miss McCain.
"John McCain will cast a long shadow," Biden's statement said. "His impact on America hasn’t ended. Not even close. It will go on for many years to come."
McCain's tenure in the House of Representatives began in 1983, and after four years he was elected to the Senate in 1986 to replace a fellow presidential candidate, Barry Goldwater. He would go on to serve Arizona as senator for the next 32 years.
"He was a great representative for Arizona," Roy Lopez, a native of Bisbee, Arizona, told ABC News on Saturday. "He took care of Arizona."
"He's a good man. He voted his conscience," Arizona resident Gail Covington McBride, a Democrat, told ABC News. "When someone votes based on American values and not just with their party, it’s hard not to admire him."
Last October, as his health declined, McCain spoke of his life in public service.
"I’ve had the good fortune to spend 60 years in service to this wondrous land," he said. "It has not been perfect service, to be sure, and there were probably times when the country might have benefited from a little less of my help.
"But I’ve tried to deserve the privilege as best I can, and I’ve been repaid a thousand times over with adventures, with good company, and with the satisfaction of serving something more important than myself, of being a bit player in the extraordinary story of America," he said. "And I am so very grateful."
McCain is survived by his wife Cindy and his seven children.
ABC News’ Adam Kelsey and Ali Rogin contributed to this report.