MOSCOW - In a battle against President Vladimir Putin that has moved from the streets of Moscow to a courtroom, Alexei Navalny has emerged as the figurehead of a new generation of Russian opposition.
The 37-year-old anti-corruption campaigner, who was handed a five-year jail sentence for theft on Thursday then freed on bail on Friday, was one of the first protest leaders arrested when demonstrations against Putin took off in December 2011.
After 15 days in jail for obstructing police at a Moscow rally, Navalny emerged as a hero for the protesters, who chanted his name and gave his booming speeches the biggest cheers.
By the time the protests started to fade in the spring of 2012, Putin was back in the Kremlin as president while Navalny had established himself as the opposition's unofficial leader.
Tall, clean-cut, confident and articulate, Navalny has more potential than any other opposition leader to at least rattle, if not directly challenge, Putin.
Thursday's verdict was seen by many as a sign that the president himself sees him as a threat, even though opinion polls suggest his appeal does not go far beyond the big cities.
"Navalny's sentence looks less like punishment than an attempt to isolate him from society and the electoral process," said former finance minister Alexei Kudrin, a Putin ally.
The surprise decision to free Navalny on bail pending an appeal suggests Kudrin's remarks and protests by thousands of people in cities have caused the Kremlin to rethink.
Within hours, thousands of protesters were out on the streets chanting Navalny's name and "Freedom!" close to the Kremlin. Some wore badges with his name, others distributed leaflets with his portrait.
"If we have even just another couple of months to fight, we will fight," Navalny said after he won bail.
Navalny has not hidden his presidential ambitions and has registered as a candidate in a mayoral election in Moscow on September 8 even though polls suggest he had little chance of winning. Had he gone straight to jail, Navalny would not have been able to run but the bail decision means he now has a chance of staying in the race.
His sentence - on charges he denied of stealing from a state timber firm - is unlikely to be overturned on appeal and this will bar him from running in the 2018 presidential election.
But Navalny is a young politician for the former Soviet world, and he can bide his time. Even if Putin is re-elected in 2018 for another six years, he would be over 70 by 2024 while Navalny would still be under 50.
CATCHING A MOOD
The son of an army officer, Navalny grew up mainly in Obninsk, about 100 km (60 miles) southwest of Moscow. He has a law degree and also studied securities and exchanges.
He represents a new, Internet-savvy generation and is seen as a potential threat to Putin even though the former KGB spy runs a tightly controlled political system that he has crafted in 14 years as prime minister or president.
Navalny operates from a sparsely furnished office just off Moscow's Garden Ring road, one of the capital's main thoroughfares, with a small team assisting him in his campaigning against corruption, mostly centred around his blog.
Usually dressed casually in a T-shirt and jeans, or sometimes in an open shirt without a tie, he looks and sounds different from most Russian political figures - many of whom dress formally in suits and ties.
"Navalny is the only possible leader I see," a Moscow-based Western banker said of Navalny's position in Russia's fragmented opposition. "He has fire in those blue eyes of his."
Navalny frequently looked disinterested at opposition meetings discussing the protests but came to life at the protests, delivering tub-thumping speeches.
He has managed to grasp a mood change in Russia among the urban youth and growing middle class two decades after the Soviet Union collapsed.
"We are not cattle or slaves. We have a voice and we have the strength to defend it," Navalny said in a statement during his 15-day jail term in late 2011.
Such simple, defiant phrases quickly caught on, none more that his description of Putin's ruling United Russia as a party of "swindlers and thieves".
"I realise there is danger, but why should I be afraid?" he told Reuters in an interview at the start of the protests.
But indicating he was aware of the risks he faced, he said in a later interview: "You need to understand a very simple thing. To keep himself in power, Vladimir Putin is ready to go very far. Much further than just putting me or anybody else in prison. Much further."
Yet Navalny's character and politics are also more complex than some admiring Western liberals might expect of a Yale-educated lawyer.
While his time in the United States on a fellowship at Yale has forced him at times into denying accusations from Putin supporters that he is a CIA plant, his hostile views on Muslim and Asian migration into Russia's Slavic heartland have at times obliged him to rebuff suggestions he has "fascist" tendencies.
Once an outspoken nationalist, he was expelled from a liberal opposition party and has promised to crack down on immigration from Central Asia and the Caucasus.
In 2007, Navalny was reported by a state news agency to have been involved in a brawl at a Moscow club. After being ejected by bouncers, he got into a fight on the street and was quoted as saying at the time that he had shot his opponent with an air pistol. Charges were later dropped.
He has toned down his rhetoric over the years and honed his image, focusing on his criticism of the authorities.
Shooting to prominence by challenging state companies such as pipeline operator Transneft to explain millions of dollars of unorthodox payments, Navalny struck a chord with millions of Russians disgusted by the ostentatious wealth of Moscow's elite.
He accused Putin of ruling a venal elite as "chairman of the board of Russia Inc" and, in his latest slight, compared the president to a toad unwilling to get off a pipeline representing Russia's vast oil wealth.
Opinion polls show Putin remains the most popular politician in Russia. But the longer Russia holds off on reforms to boost its economy, the greater Navalny's chances are of building support among frustrated voters in the big cities.