Russia's Supreme Court has ordered the release of opposition activist Ildar Dadin, who was the first person to be convicted under new laws on protests.
The court said the criminal case against him should be dismissed and he had a "right to rehabilitation", Russian media report.
Mr Dadin, jailed in December 2015, has been serving two-and-a-half years for a series of protests.
Last November he said he was tortured in prison in north-west Russia.
The authorities denied the claims, but transferred him to another prison.
Wednesday's court ruling came after Russia's constitutional court earlier this month concluded that Mr Dadin's case needed to be reviewed.
Mr Dadin was convicted under a new law - Article 212.1 - which made repeated violations of Russia's strict protest rules a crime.
He was originally jailed for three years - though the sentence was later reduced - for a series of peaceful protests, which often involved standing silently in the street with a sign.
Earlier this month, the constitutional court ruled that Article 212.1 should not be applied in cases where protests did not constitute a threat and sent it for review to the Supreme Court.
Mr Dadin appeared on a video link for Wednesday's proceedings and lay his head on a desk in protest at being refused permission to travel to the court in person, reports the BBC's Sarah Rainsford from the hearing.
His wife Anastasia cheered the court's ruling. She told the BBC she was very happy and hoped the controversial law used to imprison her husband would never be used again.
Successful deterrent? Analysis by Sarah Rainsford in Moscow
The imprisonment of Ildar Dadin had come to symbolise Russia's growing intolerance of dissent, and the fact that his sentence has been quashed does not change that.
The rules on street protests are extremely strict here. People are routinely detained simply for standing in the street, as Ildar Dadin did, with a placard.
But in theory, criminal prosecution and imprisonment for such acts should now be less likely.
It's possible that keeping the activist behind bars became uncomfortable for Russia, with increased international focus on his case and a campaign here for his release. Ildar Dadin's torture claims last year were also very widely reported.
But the law used against him remains in force. And if his harsh punishment was meant to deter others from taking to the streets in protest, most activists I've spoken to here believe that has already worked.
What is Article 212.1?
- Article 212.1 of the Criminal Code of the Russian Federation penalises those found guilty of violating Russia's protest rules at least three times within 180 days
- The current punishment ranges from a fine of 600,000 roubles (£8,200; $10,200) to one million roubles, "corrective labour" or up to five years in prison
- Mr Dadin is the only person to have been prosecuted under the law since it was introduced