UNTIL LAST weekend, Alexei Navalny was known in Russia mainly as a muckraking firebrand who had made himself a thorn in the Kremlin’s side by railing against corruption and the cooked results in parliamentary elections in 2011. That changed Sunday.

With a stunningly strong showing in Moscow’s mayoral election against an incumbent handpicked by President Vladimir Putin, Mr. Navalny has staggered Russia’s ossified political system and emerged as the country’s most electrifying opposition figure and, potentially, a plausible alternative to Mr. Putin himself.

That was not the scenario the Kremlin likely had in mind when Mr. Navalny, convicted on trumped-up embezzlement charges in July, was suddenly freed on appeal and allowed to run for mayor. In all likelihood, the powers that be regarded him as a convenient straw man whose certain defeat would lend an air of legitimacy to the inevitable victory of Sergei Sobyanin, who was appointed to the job by Mr. Putin in 2010.

Mr. Sobyanin did gain the most votes, around 50 percent in a field of six candidates. Yet that was much worse than expected. It was Mr. Navalny who, despite being barred from state television and smeared in the Kremlin-controlled media, managed to emerge triumphant.

By the official tally, he received 27 percent of the vote, nearly twice what any poll had predicted. Possibly he did even better than that.

On Monday, he rallied his mostly young, energized and well-educated supporters, condemning the official results as “fake.” The question was whether he kept Mr. Sobyanin from receiving more than 50 percent of the vote, the threshold required to avoid a head-to-head runoff. Mr. Navalny insisted that exit polling showed the Kremlin has falsified the official results, which gave Mr. Sobyanin just better than 51 percent.

As a consequence of his show trial this summer, Mr. Navalny, 37, is facing up to five years in prison, depending on the outcome of an appeal. If the conviction is upheld, Mr. Navalny will be barred from politics for life. Now the calculus of locking him up and disqualifying him from further elections may have changed. Perhaps the Kremlin was content to jail a civic activist. What about a politician with proven electoral appeal?

Russian elections in the Putin era have been mostly a charade, with rules and popular media tilted heavily in favor of officially sanctioned candidates. Mr. Navalny — brash, charismatic, savvy to social media and modern campaign tactics and possessed of an immigrant-bashing nationalistic streak — is the first opposition politician to have rattled Mr. Putin’s personal authority.

Mr. Sobyanin tried to put the best face on the results, saying the election was the fairest and cleanest in Moscow’s history. If that was the case, then the Kremlin’s hold on power could be shakier than anyone understood. Just imagine how Mr. Navalny might have fared at the ballot had the playing field been level.