Sen. John McCain (R-Ariz.), left, and Sen. Lindsey O. Graham (R-S.C.) listen during a news conference in Cairo in 2013. (Amr Nabil/AP)

Mohamed Soltan is a human rights advocate and founder of the Freedom Initiative.

I woke up a few days ago to a voice mail from my mother in Egypt consoling me about the loss of Sen. John McCain (R-Ariz.). Later in the same day, I received two text messages from contraband phones in Egyptian prisons: My friends there were grieving his loss as well. This did not come as a complete shock. McCain, after all, played a vital role in securing my own release from prison in Egypt, and without him, I would not be able to pen these words as a free man in his honor.

That I can write this strikes me as all the more remarkable, considering that there was a time when I harshly criticized him.

The senator has left our troubled world at a time when we need a man like him the most. As the lines continue to blur between fact and fiction, McCain always remained grounded in reality with an unwavering stance on freedom and morality. Advocates for human rights in the Middle East are shaken by his loss. We strongly feel his absence in the fight against oppression and tyranny in this era when human rights are far down at the bottom of the current administration’s list of priorities.

McCain’s door was always open to victims of dictatorships and authoritarian regimes. His staffers would jokingly complain that they felt as if their sole job was to save prisoners around the world. He was not only an American patriot but also a champion to millions who faced oppression. His voice echoed in some of the darkest dungeons and prisons around the globe.

During my nearly two years in prison in Egypt, the authorities sometimes allowed Islamic State recruiters into our solitary confinement wards. These extremists were deliberately deployed to convince me and other pro-democracy prisoners that hunger strikes and peaceful resistance were ineffective in the face of oppression. They argued that the United States had abandoned its own ideals and values by supporting the likes of President Abdel Fatah al-Sissi. Many of us responded to their propaganda by invoking the name of McCain. His stances proved that the West is not all the same and that American policy is not a monolith.

After soldiers marched onto Cairo streets in July 2013, McCain responded with a courage the White House did not have: He used the word “coup” to describe Sissi’s seizure of power and crackdown on the elected government. In 2015, McCain released a powerful statement advocating the release and protection of human rights defenders in oppressive countries like Egypt, of whom I was one.

When I heard that McCain had written a letter calling for my release, I was taken aback. I had long opposed his hawkish policies in the Middle East, including his support for the war in Iraq, and, as a U.S. citizen, I had tirelessly campaigned against him in the 2008 presidential election. In fact, I still disagree with him on many of his past policies and positions. And yet I was grateful for his advocacy on the Senate floor and behind closed doors. As I laid in my prison cell, many times on the verge of death and with deteriorating health, his support offered a ray of hope that only another former prisoner could understand — that feeling of being unjustly imprisoned, hopeless and helpless.

His voice was pivotal to obtaining the support of the United States in securing my release and the release of thousands of prisoners of conscience around the world.

Only someone who has experienced suffering and oppression at firsthand can continue to combat it with such passion and dedication. I, like many others, benefited from McCain’s courage and have been touched by his heroism. He will live on in history as a flawed man whose policies were often subject to his biases and limitations — but also, more importantly, as a principled man who was committed to justice, democracy and human rights. His courage in the political arena intimidated and struck fear in the hearts of tyrants.

McCain was a testament to the fact that one could be a decent human and politician while remaining true to universal values and principals. Today, tyrants and dictators celebrate while we, the victims of authoritarianism, mourn and grieve.

Yes, the loss of McCain is an exceptionally devastating loss for human rights defenders across the world. It leaves a massive void at a time when that community is enduring abuse and defeat, and is losing many of its staunchest champions. His passing will in turn embolden demagogues, authoritarians and dictators around the world for many years after the news about his death has faded. He was a firewall against state oppression for many people, and it is unclear if there is anyone who will be able to fill his shoes.

From one former prisoner to another, I promise to share the spirit of freedom McCain has injected into my life and the lives of others. I pledge to help others in the spirit of his courage and dedication, and I hope that he can somehow feel the ripple effect of the goodness he has brought into this world.

May God forgive his shortcomings and have mercy on his soul.