John McCain first came to public attention when the US Navy jet he was piloting was shot down during the Vietnam War in a bombing raid on Hanoi in October 1967.
At the time, his father was an admiral and commander-in-chief of Pacific forces.
The North Vietnamese recognised the propaganda value in offering the young pilot early release.
But Mr McCain, whose broken body had been seen on television screens around the world, refused to break the military code that prisoners of war are released in the order that they are captured.
John McCain: Outspoken critic of the handling of the Iraq war
Thus began more than five hard years of imprisonment, during which he was subjected to beatings and torture at the infamous "Hanoi Hilton" prison.
He eventually returned to the US walking on crutches, and still finds it difficult to move one of his arms above shoulder level.
And so a modern American legend was born.
His best-selling book, Faith of my Fathers - which made much of his early life, family background and experiences in Vietnam - became the launch pad for the Arizona senator's ultimately unsuccessful presidential election campaign in 2000.
During his career in the Senate, he has become a important voice on foreign affairs - particularly, in recent years, Iraq.
But Mr McCain is also notorious among Republicans for refusing to toe the party line on big issues.
He is an aggressive opponent of the tobacco industry and a strong advocate of political campaign finance reform, two issues that have brought him support from the more liberal wing of US politics.
But despite the maverick image and unpopularity with the religious right, he remains a conservative through and through, particularly on the key issue of abortion.