Ivan Sekretarev / AP Russian opposition leader Alexei Navalny gestures while speaking during a rally in Moscow on Sept. 9, 2013

Just after midnight on Sept. 8, while the votes were still being counted in Moscow’s mayoral election, a volunteer brought two bottles of chilled champagne into the campaign headquarters of Alexei Navalny. The candidate already had enough to celebrate. As leader of the opposition to President Vladimir Putin’s rule, Navalny actually had a chance of winning the second most important elected office in Russia. Exit polls suggested he would get nearly a third of the popular vote, beyond even the most optimistic predictions. Meanwhile, the acting mayor, Sergei Sobyanin, Putin’s former chief of staff, was struggling to get above 50%, risking a runoff ballot with a man who has devoted his career to ousting Putin’s government. The political invincibility of the ruling elite had already been cracked.

But Navalny, who sat glued to the screen of his laptop as the results came in, forbade his staff from popping the corks. “It’s bad luck,” he said in his cramped basement headquarters. “You might jinx it.” For one thing, Navalny was convicted of embezzlement in July and sentenced to five years in prison, a verdict that most political analysts and rights groups condemned as part of the Kremlin’s attempt to silence him. After thousands of Muscovites came out to protest the verdict, the court gave Navalny his freedom pending appeal, allowing him to run in these elections. But even if he were to win the race, it is far from clear that Navalny’s sentence would be suspended. And across town, Mayor Sobyanin was at that moment celebrating victory with a fireworks salute above the Kremlin. “In the end we will win regardless,” Sobyanin, one of Putin’s closest allies, told the crowd of his supporters.

(VIDEO: Russian Court Jails Putin’s Most Influential Opponent)

Still, his confidence rang hollow. Although candidates from Putin’s political party had swept most of the roughly 7,000 local and municipal elections held on Sept. 8 — Russia’s national voting day — opposition candidates broke the ruling party’s effective monopoly on power in some of the most important ballots. In the mayoral race in Russia’s fourth largest city, Yekaterinburg, the opposition candidate Evgeny Royzman defeated his rival from Putin’s party. Best known for his campaigns to rid the city of drug addicts, Royzman is an ally of the metals tycoon Mikhail Prokhorov, whom the Kremlin allowed into national politics in 2011 to help co-opt and absorb the growing tide of protest voters. At his party’s campaign headquarters in Moscow, Prokhorov, the billionaire owner of the Brooklyn Nets, was in a jubilant mood on Sunday night. “If you guys run out of water or tea or anything, just let me know,” Prokhorov told his party’s campaign staff as he hovered over them, waiting for the final results.

The conduct of these elections, he told me, are a sign that the Kremlin is trying to adapt to the public demands for change. “What we’re seeing is a test of the political system based on the new electoral realities,” he said. The test allowed numerous upstart candidates, who are normally barred from national politics, to run in these elections. Based on opinion polls, which initially suggested Navalny would get less than 10% of the vote, the Kremlin figured that its men could trounce Navalny and the other opposition candidates, giving themselves a greater air of legitimacy while discrediting their rivals.

In some cases, they passed the test. The race for governor of the Moscow region ended in a landslide victory for Andrei Vorobyov, a rising star in Putin’s party. Running on behalf of the opposition movement was Gennady Gudkov, who was forced out of parliament last year after leading anti-Putin demonstrations in Moscow. But he could not even get 5% in the official vote count on Sunday. His son Dmitri Gudkov, who is a sitting Member of Parliament, was distraught over the news that night. “They fought dirty,” he told me at the office of father’s private-security company, which the state drove out of business last year after the family turned against Putin. “They needed to legitimize their own rule and discredit the opposition.”

But in many elections, that effort failed. The so-called constructive opposition parties, which the Kremlin nurtures to create a false sense of political competition, were thoroughly discredited on Sunday, revealing the public’s demand for real alternatives instead of the usual Kremlin puppet parties. “The political landscape is changing,” said the younger Gudkov. “They can’t continue to offer the same old lineup.”

Nowhere was the new landscape clearer than in the race for mayor of Moscow. On Monday morning, the official results showed Navalny with 27% of the vote, far ahead of all the candidates from the “constructive” opposition. The incumbent mayor barely slipped passed the post with 51% in the official count. But the fact that Sobyanin avoided a runoff vote against Navalny by less than 30,000 ballots led immediately to claims of voter fraud from the Navalny camp. “This is an obvious fraud committed by the mayor’s office on the apparent orders of the Kremlin,” Navalny told reporters at 2:00 a.m. on Monday. “We will call on our fellow citizens to take to the streets of Moscow if the mayor’s office will continue these blatant violations of the voters’ rights.”

(MORE: Putin’s Public Enemy No. 1: A Visit With Alexei Navalny)

As the votes were being tallied throughout the night, battles raged among election observers over every disputed ballot. The most important fight took place at a startup incubator called Digital October, a haunt for Moscow’s hipsters and political malcontents, where a board of observers sat watching CCTV footage of alleged voter fraud in a conference room in the middle of the night. Representing the opposition was Alexei Venediktov, the head of a liberal radio station whom Putin once accused of “pouring diarrhea on me from morning till night.” When the loyalist observers tried to hush up an incident of voter fraud, Venediktov flew off the handle. “I didn’t sign up for this crap!” he shouted, threatening to walk out if they did not call for an official recount at the disputed polling station. The others conceded, and a formal complaint was lodged with the authorities.

All eyes were still on these disputes on Monday, as even a partial recount had a chance of pushing Sobyanin’s results below 50%. That would spark a runoff election between a candidate from Putin’s inner circle and a revolutionary who has pledged to put Putin on trial. Even a year ago, such a possibility would have been unthinkable. Navalny was effectively barred from all the major TV networks before this mayoral race and kept out of mainstream politics. Before this summer, Putin even refused to utter Navalny’s name when asked about him directly. So whatever the outcome of these elections, the opposition has managed to break through the Kremlin’s political blockade.

In Russia’s capital, Navalny garnered roughly half a million votes, which will make it much harder for the state to throw him back in prison. At a polling station near Gorky Park, Sergei Lomakin, a 31-year-old lawyer, went to vote for Navalny with his wife and infant daughter. “It’s our generation’s turn to rule,” he told me after casting his ballot. “Since we’d rather not go the road of a revolution, voting is still our best hope of affecting change.” Yet revolutionary thoughts were still not far from Navalny’s mind on Monday night, when he addressed tens of thousands of his supporters at a rally near the Kremlin. “When the time comes, and it may well come, when I will ask you to take part in unsanctioned protests, to overturn cars, light flares, and maybe something else, I will tell you straight up,” he said. “I will be there with you sleeping on the asphalt.” The crowd, roaring in approval, soon began to chant, “Recount! Recount!”

The chance of a recount began to seem real just before Navalny’s speech, when Moscow’s official election commission announced that it was prepared to review his allegations of fraud. But back at Navalny’s headquarters, the champagne bottles still stood on the table unopened. “When we get a runoff vote, we’ll pop them,” one of the campaign officials, Pyotr Verzilov, told me. Until then, Navalny’s supporters can only enjoy a partial victory; competition has, for the moment, returned to Russian politics.

Cover Story: The World According to Vladimir Putin