Yuri Dmitriev's real crime, according to activists, was dedicating himself to documenting Stalin's 1937-38 Great Terror and discovering a mass grave with up to 9,000 bodies dating from the period.
A Russian gulag historian was on Thursday acquitted of child pornography charges and released in a move supporters hailed as a rare victory for the country's embattled rights activists.
Dmitriyev, whose trial sparked an outcry from rights activists and liberals, spent decades locating and exhuming mass graves of people killed under Soviet dictator Joseph Stalin's rule.
Activists have said the case against him was an attempt by authorities to muzzle the outspoken historian who has called attention to one of the darkest chapters in Russia's history.
His real crime, they said, was dedicating himself to documenting Stalin's 1937-38 Great Terror, in which nearly 700,000 people were executed, according to conservative official estimates.
Dmitriev found a mass grave with up to 9,000 bodies dating from the period.
"I am free," shouted historian Yury Dmitriyev after he was released in the courtroom following a closed-door hearing in the northwestern city of Petrozavodsk. His controversial trial prompted an outcry from rights activists and liberals.
One of his daughters, Yekaterina, greeted her father in tears as supporters shouted "hurray."
Dmitriyev, who had spent more than a year in pre-trial detention, was however found guilty of firearm possession and released on conditions that will limit his freedom for the next three months.
He was handed a sentence of two-and-a-half years' "restricted freedom" – but he only has three months left due to the time he spent in pre-trial detention, defence lawyer Viktor Anufriyev told reporters.
The 62-year-old, who is the head of rights group Memorial's branch in the northwestern Karelia region, called the ruling "just".
"Because nothing bad had happened," he said.
He said the authorities could not simply let him walk free after the high-profile trial, describing the firearm he was convicted of possessing as a fragment of "scrap metal" he had found some 20 years ago.
Prosecutors had requested nine years in a "harsh regime" colony for the outspoken activist.
The case centred on naked photographs of Dmitriyev's then pre-teen adopted daughter Natalya seized during a search of his home after an anonymous tip-off to police.
Dmitriyev's defence said the photographs were taken to track the girl's improvement as she recovered from malnutrition.
Observers had expected the verdict to serve as a barometer for the country's direction under the fourth Kremlin term of President Vladimir Putin, who extended his rule until 2024 in an election last month.
Many had not expected an acquittal.
Oleg Orlov, a senior director at Memorial, hailed the ruling as a rare victory for civil society.
"In Russia, society needs to make colossal efforts to achieve a just verdict," he said.
Anatoly Razumov, a historian who researched Soviet-era purges, said the ruling would send a clear signal to those who had wanted to muzzle the historian.
"Those who were behind this will understand that it's not that easy to overpower us," he said. "It was a complicated, far-reaching case, and we've won."
In a statement released before the announcement of the verdict, top rights activists including Lyudmila Alexeyeva, head of the Moscow Helsinki Group, pointed to multiple procedural violations.
"Dmitriyev's actions did not exceed the scope of normal parental care over his child's development and health," they said.
Dmitriyev was arrested in late 2016 and spent more than a year in pre-trial detention before being released in January after calls from prominent figures for him to be freed.
Experts who last examined the pictures of Dmitriyev's adopted daughter concluded that they were not pornographic but the prosecution disagreed, his defence team said.
Dear dad, I miss you
Instead of making a speech in his defence last week, Dmitriyev read out in court a letter Natalya, 12, sent to him while he was in pre-trial detention.
"Dear dad, I miss you very much. I am hoping that you will be released soon," said the handwritten letter, a copy of which was published by Novaya Gazeta.
"Love you with all my heart," said the letter decorated with red hearts.
The girl now lives with her grandmother, who originally sent the child to an orphanage before the historian adopted her.
Dmitriyev helped open the Sandarmokh memorial in a pine forest in Karelia in memory of thousands of victims – including many foreigners – executed in 1937 and 1938.
He was released from pre-trial detention in January after prominent figures including Natalia Solzhenitsyna, the widow of the Nobel Prize-winning author Alexander Solzhenitsyn, urged that he be freed.
Rights groups have accused Putin of seeking to whitewash Stalin's crimes amid patriotic fervour whipped up by state propaganda.
Historians estimate about one million people perished in Stalin's Great Purge in the 1930s, out of around 20 million who died under his three-decade rule before his death in 1953.