Shortly before his court appearance in the southern Russian city of Rostov-on-Don, investigators stopped by Hennadiy Afanasyev's holding cell to make sure he still planned to implicate his fellow Ukrainians, film director Oleh Sentsov and left-wing activist Oleksandr Kolchenko, as "terrorists."

"I told them all 'yes, yes,' so they'd think that everything was fine," Afanasyev, 25, told RFE/RL's Russian Service in a recent interview.

But Afanasyev, a photographer from Crimea who was arrested months after Russia annexed the Ukrainian peninsula and convicted of plotting a terrorist act against the Russian-imposed authorities, had a surprise in store.

When he was brought before the judge on July 31, 2015, he recanted his earlier testimony that served as the basis of Russia's case against Sentsov and Kolchenko, saying he had been coerced into implicating them.

Sentsov, whose jailing drew appeals from prominent figures in international cinema, responded with applause from his courtroom cage and yelled "Glory to Ukraine!" Afanasyev replied, "Glory to the heroes!"

"Returning to my holding cell, I already felt free," said Afanasyev, one of two Ukrainians released from Russian prison last week in Kyiv's second recent high-profile prisoner exchange. "In that very moment I destroyed the shackles that had kept me in fear and pain."

Complete redemption, however, remains elusive for Afanasyev, who expressed remorse that he testified in the first place against Sentsov and Kolchenko. The pair were sentenced in August to 20 and 10 years in prison, respectively, after being convicted of terrorism charges that rights groups and Western governments call a travesty of justice.

Afanasyev claims he was beaten and tortured into implicating the men. "Even now I'm upset that I couldn't withstand the torture, and I feel very ashamed before the guys," he said.

'Maybe I Wouldn't Even Be Alive'

Russia is holding more than 20 Ukrainian nationals on politically motivated charges, according to the Moscow-based Memorial Human Rights Center, though the Kremlin is showing signs that it's prepared to cut deals for their release. Moscow indicated in April that it was considering transferring Sentsov and Kolchenko to Ukraine at Kyiv's request, though both men remain in Russian custody as of June 21.

Afanasyev and Yuriy Soloshenko, a 73-year-old former electronics plant chief convicted in Russia of spying in October, arrived in Ukraine on June 14 after being swapped for two Ukrainians charged with supporting Russia-backed separatists in the east of the country.

The swap came three weeks after a prisoner exchange that returned Ukrainian airwoman Nadia Savchenko to Russia. Her nearly two years in Russian custody drew widespread condemnation from Western governments and rights activists.

Afanasyev said he planned to give up professional photography and would like to use his legal education -- and his experience in Russian captivity -- to fight for the release of other Ukrainian political prisoners and others being held by separatist forces in eastern Ukraine.

"I know what the people who are arrested want, and I know what the people controlling them want," he said.

His decision to recant his testimony did not come without consequences. Afanasyev said after he was taken away from the courtroom, officers from Russia's Federal Security Service shackled him and "beat me up a little." Luckily, he said, journalists, lawyers, and rights activists made sure his case did not disappear from public view.

"Otherwise, I don't know. Maybe I wouldn't even be alive," he said.

'We See That This Is A Political Case'

Sentsov, Afanasyev, and other Ukrainians from Crimea imprisoned by Russia say they were targeted because of their opposition to the Kremlin's annexation of the peninsula in March 2014, which triggered international outcry and Western sanctions against Moscow.

Afanasyev said that even during his time in Russian custody, his jailers acknowledged the political nature of his imprisonment. "The officers in the prison colonies told me numerous times: 'We see that this is a political case. But you've been convicted, and you're going to serve time for this,'" he said.

His conviction on terrorism charges, he said, was a source of constant laughter among both law enforcement officials and his fellow inmates. "They would say, 'You, a terrorist?' Inmates would tell officers in front of me: 'Look at this terrorist. I'm more of a terrorist than he is,'" Afanasyev said.

During his imprisonment, he added, he took deep consideration of the consequences he would face by recanting his original testimony against his countrymen. "At some point," Afanasyev said, "I decided that my life, my freedom, my future destiny cannot be more important than the lives of these two people who are not guilty of anything."

Written by Carl Schreck based on reporting by Anton Naumlyuk of RFE/RL's Russian Service