A Russian court on Friday unexpectedly freed protest leader Alexei Navalny pending his appeal against a five-year sentence on embezzlement charges, after his jailing prompted thousands to take to the streets in protest.
The judge in the northern city of Kirov ruled that keeping President Vladimir Putin's top opponent in custody would deprive him of his right to stand in mayoral elections in Moscow on September 8.
"What happened now is a completely unique phenomenon in the system of Russian justice," said Navalny, who was immediately set free from the glass-fronted defendants' cage and rushed to embrace his wife Yulia.
A lower court in the city of Kirov 900 kilometres (560 miles) northeast of Moscow had on Thursday sentenced Navalny to five years in a penal colony, in a decision that sparked international concern.
Navalny was found guilty of defrauding the local government in the Kirov region of 16 million rubles ($500,000, 376,000 euros) in a timber deal while acting as an unpaid advisor to the local authorities in 2009.
Navalny's co-accused, Pyotr Ofitserov, who was sentenced to four years in prison, was also released on Friday pending his appeal.
The sentence has thrown up another bone of contention between Moscow and Washington, with President Barack Obama due to visit Russia for the September 5-6 G20 summit in St Petersburg.
Activists said the conviction was ordered by the Kremlin for Navalny daring to challenge Putin and late Thursday thousands of his supporters filled the central avenues of Moscow and Saint Petersburg in unexpectedly large protests.
The guilty verdict disqualifies Navalny from politics, but the restriction will come into force only if the verdict is upheld on appeal, leaving him still able to stand in the upcoming Moscow mayoral elections.
Navalny said he was not a "pet kitten or puppy" who could be first "kicked out of the elections" and then invited back.
He said he would decide upon his return to Moscow if he would continue his campaign or boycott the polls, where he was due to challenge pro-Putin mayor Sergei Sobyanin.
"If we have at least two more months to fight, we will fight," he added.
Many observers say the jailing of a high-profile mayoral candidate during the campaign was a huge embarrassment for the authorities and link the prosecutors' decision to appeal to a possible change of heart by the Kremlin.
"What kind of elections are we talking about if one of the candidates is in prison?" commentator Yulia Latynina wrote in opposition newspaper Novaya Gazeta earlier Friday. "In fact, this deprives the mayoral elections of legitimacy."
The judge in his ruling on Friday said that Navalny's jailing would "limit his right to be elected" and put him at a disadvantage compared to other mayoral candidates.
--- 'A disturbing trend' ---
More than 200 people were arrested after several thousand rallied near Manezh Square in central Moscow to protest Navalny's sentencing. All have now been freed with caution.
The Moscow municipality shut down Red Square, ostensibly for "repairs", in an apparent bid to prevent protests on the iconic Moscow landmark.
Police said that 2,500 people took to the streets in Moscow, while activists put the turnout at 10,000 and higher. Some 2,000 people rallied in Putin's hometown Saint Petersburg, according to AFP estimates.
The Kremlin has remained conspicuously quiet since the Kirov court delivered its initial guilty verdict on Thursday.
Navalny, who emerged as a powerful new force in mass protests in 2011-2012, said he wants to challenge Putin in the next presidential election in 2018 and coined the phrase "the party of crooks and thieves" to describe the ruling United Russia party.
Thursday's decision to sentence the 37-year-old father of two to five years in a penal colony on fraud charges prompted global concern and risks further straining ties between Moscow and the West.
"Navalny's harsh prison sentence is the latest example of a disturbing trend of government actions aimed at suppressing dissent in civil society in Russia," White House spokesman Jay Carney said.
Obama and Putin agreed in June to hold a separate summit on September 3-4, just before the G20 talks, but White House officials have been coy about whether that meeting was still scheduled.
The United States is already furious over the almost month-long stay in Moscow airport's transit zone of intelligence leaker Edward Snowden, who Washington wants to put on trial but who has now applied for asylum in Russia.