A few months after the 2008 elections, I happened to be in Washington and sought out my old friend senator John McCain. I hoped to express my support in the face of his defeat in those elections, and my confidence that his legacy wouldn’t be defined by it. I was taken to a small chamber in the Senate to await McCain, who was embroiled in a legislative battle on the floor and didn’t want to leave the building.

The man who walked into the chamber to meet me was glad to receive my condolences and assurances, but he didn’t need them. His defeat was no longer on his mind. He was afire, instead, with his passion for his most recent battle, the crusade to outlaw torture. “I don’t need to explain to you why we must stop this,” he said, dismissing the criticism his position drew from his own political camp. “We understand.”

The “we” senator McCain spoke of, and the affinity he alluded to, was formed in our very first meeting, when I visited the US shortly after my release from the Soviet gulag in 1986. “I understand why you refused to be released on the USSR’s terms two years ago,” he told me then, referring to a deal I rejected, to the shock and consternation of many western supporters.

Many couldn’t understand why I refused to request an early release from prison for health reasons. After all, the Soviet authorities had secretly promised their American counterparts that they would grant such a request. McCain, who experienced the horrors of captivity and dictatorship first hand, understood what they couldn’t.

He knew how such a request would have been presented by the Soviet authorities, how they would have used it to claim that I, their critic, accepted their authority to control my fate. He knew how it would have been used to break the spirit of other dissidents.

McCain understood my reasons because he himself had made the same choice. When the North Vietnamese government offered to release him ahead of other POWs, he declined, despite the atrocious conditions in which he was held. Some values, he knew, stood above survival and comfort.

McCain’s first-hand knowledge of these realities and truths shone through his endeavours throughout his long and illustrious political career. He never stopped supporting dissidents who suffered under dictatorial regimes, and he never forgot that some things should take precedence over realpolitik considerations and party lines.

It was this deep conviction that motivated him to speak against a realpolitik approach to the situation in the Soviet Union, in Syria and in Iran. And it was this conviction, too, that compelled him to fight against torture in Guantanamo Bay regardless of his own party’s criticism. He knew that justice itself, as well as the United States’s moral integrity, was on the line.

The man who came to meet me in that small chamber in the American Senate didn’t need my encouragement and support. He didn’t need me to tell him that his principles, and not his defeat in the elections, would define his legacy in years to come. He was already afire with those very principles, and with his deep commitment to his country’s moral integrity and dignity.

The American people lost a man of rare integrity this week, and I lost a very dear comrade in arms. May his legacy live on.