Russia's highest court ordered a review of the precedent-setting case of an opposition activist jailed for two-and-a-half years for peaceful protests.
The Constitutional Court called for a compulsory review of the case of 34-year-old Ildar Dadin after he became the first Russian to be jailed for repeated participation in unsanctioned rallies.
Dadin was sentenced in 2015 to three years in jail, later reduced by six months. In prison, he has complained of torture and abuse, while international rights organisations have campaigned for his release.
Dadin has called for his jailing to be recognised as unconstitutional, an appeal that the Constitutional Court on Friday partially supported.
A Russian who is detained once at an unsanctioned rally does not face jail, only a fine or time in police cells.
In 2014 Russia controversially introduced criminal charges for those who breach rules at protest rallies twice or more in a period of 180 days.
In a ruling published on its website, the Constitutional Court confirmed the government has the right to prosecute people for repeated non-criminal offences, but stressed that punishment should be proportionate.
A court should choose whether to press criminal charges according to "the real scale of public danger" and only jail protestors after rallies that were not peaceful, the decision said.
Amnesty International, which calls Dadin a prisoner of conscience, said the ruling "offers a rare glimmer of hope for the right to peaceful assembly" in Russia.
"It sends a strong message to the authorities," the rights NGO said in a statement, calling for Dadin to be released "immediately and unconditionally."
Dadin must now wait for the Russian Supreme Court to review his case. It can then order his release from the penal colony where he is being held.
The ruling is likely to be largely symbolic for Dadin, who has been in jail since February 2015, including pre-trial detention, and has only six months left to serve of his sentence.
Dadin's wife Anastasiya Zotova told AFP that the court's decision was "better than we could have expected in an authoritarian state."
She said she hoped legislation will be eased so "people aren't thrown in jail for peaceful protests."
If Dadin's sentence is overturned, "he might only come home a month early, but even that month is important," she added.