MOSCOW — Hundreds of supporters greeted the charismatic Russian opposition leader Alexei Navalny as he returned to Moscow on Saturday after his surprise release from jail and vowed to push forward with his campaign to become mayor of the Russian capital.

Navalny was convicted of theft and sentenced to five years in prison on Thursday in the city of Kirov, in what many considered a politically motivated case aimed at silencing a fierce Kremlin critic.

Less than 24 hours after his conviction for embezzling 16 million rubles ($500,000) worth of timber from a state-owned company in 2009, prosecutors unexpectedly asked for his release, saying that keeping him behind bars during the appeals process would deprive him of his right to run for office.

A day before the conviction, Navalny was registered as a candidate for the Sept. 8 mayoral election.

Hundreds of police blocked Navalny supporters from the platform of the Moscow railway station where his overnight train from Kirov arrived at the capital's Yaroslavsky station.

Through a bullhorn, he addressed backers who were behind the police lines and on nearby station platforms, thanking those who turned out for a large demonstration near the Kremlin protesting his sentence on Thursday, which he credited as key in securing his release.

"I realize that if it wasn't for you I wouldn't be standing here for the next five years. You have destroyed a key privilege that the Kremlin has been trying to keep — that it is their alleged right to say to any person 'arrest him on the spot'," said Navalny, who claims that the case against him was concocted for political reasons.

Navalny is one of the most visible and charismatic leaders of the opposition to President Vladimir Putin and the governing United Russia party. His description of United Russia as the "party of crooks and thieves" has become a signature phrase of the opposition.

Immediately after his release, Navalny said he hadn't decided whether to continue his mayoral campaign.

But on Saturday he declared "we are going to run in this election and we will win."

His supporters shouted "We are the power."

The surprising about-face involving Navalny highlights an open rift between factions in Putin's government that could be as unsettling for the leadership as any opposition figure, experts say.

Analysts saw Navalny's sudden release as likely reflecting arguments within the Kremlin about how to respond to his popularity. He has earned a wide following among his urban middle-class supporters, even if he has little influence among everyday Russians.

They also saw the move as an attempt to lend legitimacy to the Sept. 8 mayoral vote widely expected to be won by a Kremlin-backed incumbent who resigned last month, forcing a snap election that would make challengers scramble to organize their campaigns.

An opinion survey in early July by the independent Levada polling center showed Navalny attracting only about 8-percent support among likely voters in the mayoral election. It was unclear if the events of the past week would boost his support.