The death of US Senator John McCain has sparked a bipartisan outpouring of mourning in the US. McCain was an incredibly brave soldier, a politician who occasionally took principled positions against his party, and a man who, for the most part, conducted his campaigns with grace and dignity. I disagreed with him on most issues, but respected him as a man and statesman

HIs grandfather and father were admirals, but McCain’s rebellious nature earned his share and more of demerits at the Naval Academy. As a naval pilot in the Vietnam War, he was tasked with flying dangerous missions and then landing his plane on a narrow and moving runway. On his 23rd mission over North Vietnam, he evaded anti-aircraft fire and dropped his payload, but his plane was then hit by a Soviet-made missile.

When his parachute landed, he was beaten and stabbed with a bayonet. He recovered in a North Vietnamese hospital and was offered an early release because his father was an admiral. McCain decided that accepting an early release would hurt the morale of prisoners left behind, and so he refused to be released before the other captives.

McCain paid for this resistance. His captors broke again the arm that had been broken when his plane was shot down. They also broke his ribs and knocked out his teeth. He spent months at a time in solitary confinement, often on starvation rations. But he became the leader of the prisoners, communicating through messages tapped out in the walls. Again, he was offered an early release; again, he refused, and again, he was tortured. When he was finally released with other prisoners in 1973, he had lost nearly 48kgs. He was never able to raise his arm above his head, and his movements were impaired in other ways for the rest of his life.

When the pain of his torture became too great, McCain gave up names – of the starting lineup of the Green Bay Packers, a professional football team in the US. Throughout his career, he was one of the most consistent Republican voices against the torture of suspected terrorists, arguing both that it was morally repugnant and that it produced information of little use.

McCain’s friend, former Senator and Secretary of State John Kerry, came out of Vietnam wary to commit the US military to combat, but McCain emerged as a consistent advocate of the use of the use of force. He supported both wars in Iraq and in Afghanistan, and sought to arm rebels fighting against Bashar al-Assad in Syria. He was also a consistent sceptic of overtures to Russia by the Obama and Trump administrations.

In the US Senate, McCain was a skilled politician, and this meant that he generally voted with his party and was willing to adjust his positions to win re-election. Facing a Tea Party challenger in the Arizona GOP primary, McCain even announced that he would vote against the immigration bill that he had early championed. As his party moved right, he moved with it, but he famously criticised Christian Right activists as “agents of intolerance.”

McCain earned a reputation as a maverick in the Senate by bucking his party on a number of important issues. He championed campaign finance reform that culminated in the landmark McCain-Feingold Act. He supported the regulation of tobacco, when the industry was giving large sums to his party to block such regulations.

One of his final votes killed a poorly written healthcare bill offered by Senate Republicans in 2017. McCain was not always a maverick, and liberals pointed out that he generally voted with his party. But he voted against his party often enough to earn the enmity of the far right, which spread ugly rumours about his military record. It is easy to find websites that claim that he was a traitor pardoned by President Richard Nixon, which rates as one of the ugliest lies in contemporary politics.

McCain had a volcanic temper, often attributed to his years of torture during which rage was a survival strategy. He was known to scream at friends and adversaries alike. He also had a sharp-but-gracious sense of humour.

More importantly, he believed that the country needed respectful political debate, and his character shone through in his campaigns. During the 2008 presidential campaign, McCain defended his opponent against dishonest attacks. When he got a question attacking Barack Obama, he replied that his rival was a good man with whom he disagreed. Pressed by a second question, McCain again defended Obama, drawing boos from the crowd.

Later at the Alfred E Smith Foundation dinner in New York in the final weeks of the campaign, McCain showed off his highly refined sense of humour and closed the speech by praising Obama, who he called his friend. The speech can be seen here, and at a time when the US president tweets insults daily, it is worth seeing how politics has in the past been contested by men of honour.

During the 2016 primaries, Donald Trump declared that McCain was no hero because he had allowed himself to be captured. McCain forgave this personal insult and endorsed Trump after the GOP convention, but when tapes surfaced in which Trump bragged of assaulting women, he withdrew his endorsement.

McCain asked that Trump not attend his funeral and that George W Bush and Barack Obama give his eulogy. McCain’s life and the bipartisan mourning that his death has caused allow us to hope that American politics can survive the nasty rhetoric of our current president and return to a more principled and respectful debate.

The views expressed in this article are the author’s own and do not necessarily reflect Al Jazeera’s editorial stance.