Senator John McCain, who faced down his captors in a Vietnam prisoner of war camp and later turned his rebellious streak into a 35-year political career, has died after battling brain cancer for more than a year.
Mr McCain, 81, was elected to the Senate from Arizona six times but twice thwarted in seeking the presidency.
Mr McCain returned to the Senate in 2009, determined not to let that defeat define him.
In his valedictory memoir, The Restless Wave, Mr McCain wrote of the world he inhabited: “I hate to leave it. But I don’t have a complaint. Not one.”
He continued: “I’ve known great passions, seen amazing wonders, fought in a war and helped make a peace… I made a small place for myself in the story of America and the history of my times.”
But former vice president Joe Biden put it this way: “I think John’s legacy is that he never quits.”
Notably just last year, Mr McCain was the decisive “no” on legislation to repeal the Affordable Care Act.
That made him the unlikely saviour of the signature legislative achievement of Barack Obama, the man who beat him for president in 2008. He also ran in 2000, losing the Republican nomination to George W Bush.
Also notable were the times Mr McCain held his tongue in service of a party or political gain.
For a time, he stuck by the party’s 2016 presidential nominee, Mr Trump, even when Mr Trump questioned his status as a war hero by saying: “I like people who weren’t captured.”
Mr McCain declared the comment offensive to veterans.
Mr McCain said he would rather write in the name of a conservative Republican “who’s qualified to be president”.
When Mr Trump blamed him for the survival of the Affordable Care Act, Mr McCain sniffed, “I’ve faced tougher adversaries.”
John Sidney McCain III was born in 1936 in the Panama Canal zone, where his father was stationed in the military.
He attended the US Naval Academy and in October 1967, Mr McCain was on his 23rd bombing run over North Vietnam when he was shot out of the sky and taken prisoner.
He refused an early release offered by his captors as a propaganda ploy.
Later, his will broken by beatings, Mr McCain signed a confession. That was his darkest hour in captivity. But his recovery from that episode taught him to trust himself, he later wrote.
Mr McCain’s fellow POWs appointed him camp entertainment officer, chaplain and communications chief. To them, he imparted comic relief, literary tutorials, news of the day — and even religious sustenance.
Mr McCain returned home from his years as a POW on crutches and never regained full mobility in his arms and leg.
In 1981, he married Cindy Hensley, the daughter of a wealthy beer distributor in Arizona.
By 1982, he had been elected to the House and four years later to an open Senate seat. He and Cindy had four children, to add to three from his first marriage. Their youngest was adopted from Bangladesh.
Mr McCain cultivated a conservative voting record and a reputation as a tightwad with taxpayer dollars.
But just months into his Senate career, he made what he called “the worst mistake” of his life, participating in two meetings with bank regulators on behalf of Charles Keating, a friend, campaign contributor and savings and loan financier later convicted of securities fraud.
As one of the “Keating Five”, Mr McCain was cited by the Senate Ethics Committee for “poor judgement”. To have his honour questioned, he said, was in some ways worse than the torture he endured in Vietnam.
In the 1990s, Mr McCain shouldered the long effort to account for American soldiers still missing from the war and to normalise relations with Vietnam.
He also took on conservatives in his party over the federal debt and Democrats over foreign policy.
During his final years in the Senate, Mr McCain was perhaps the loudest advocate for US military involvement in Iraq, Syria, Libya and more.
That often made him a critic of first Mr Obama and then Mr Trump, and moved him further away from the growing isolationism within the Republican Party.
In October 2017, Mr McCain blistered Mr Trump’s “America first” foreign policy approach as a “half-baked, spurious nationalism cooked up by people who would rather find scapegoats than solve problems”.