THE FIRST indication that things were not going according to plan for Vladimir Putin’s ruling party at city-council elections in Moscow came when the official exit polls failed to materialise as expected at 6pm on September 8th. By the early hours, the once-mighty majority enjoyed by United Russia, a pro-Kremlin party, had taken a huge dent, a clear sign of a growing mood of discontent in the capital.

Before the election, United Russia had held 40 of the 45 seats in the largely powerless but symbolically highly significant city council. By the time the final votes were totted up on the morning of September 9th, it had seen that total fall by almost half, to 25.

The Communist Party, the largest officially recognised opposition party, won 13 seats, up from five last time around. Yabloko, the only genuine opposition party allowed onto the ballot, saw all four of its candidates enter the city council. A Just Russia, a centre-left party that, like the Communists, is part of the Kremlin-loyal “opposition”, won three seats.

United Russia’s near collapse was all the more remarkable given that over a dozen aspiring candidates linked to Alexei Navalny (pictured), Mr Putin’s most prominent domestic critic, had been barred from the polls, a move that sparked weeks of protests in Moscow over the summer. The decision to blacklist the opposition figures was reportedly taken when the Kremlin realised that they would win at least nine seats, providing them with a political springboard for parliamentary elections due in 2021. But the move turned the election into a referendum on its own record.

A number of United Russia candidates who had opted to run as nominal independents in a bid to mask their association with the regime. Mr Navalny outed them as members of the party. United Russia’s ratings have slumped to near-record lows this year, amid anger over an increase to the national pension age and frequent allegations of corruption. Mr Putin’s popularity has also slumped, for the same reasons. Crucially, Mr Navalny also called on his supporters to vote for whichever candidate was best-placed to defeat United Russia, even if that meant pro-Kremlin parties.

Mr Navalny’s tactic had some odd effects. Liberal Russians who celebrated the collapse of the Soviet Union in 1991 gritted their teeth and voted for Communist Party candidates, some of them open admirers of Joseph Stalin. “It’s not ideal, but there’s no other way left to register my disapproval of United Russia in Moscow,” said Mikhail, a middle-aged voter in Moscow. “The Communists have the best chance of victory.”

Even widely reported ballot-box trickery was unable to save one United Russia heavyweight. Andrei Metelsky, the head of the party’s offices in Moscow, lost his seat to a little-known socialist running on the Communist Party ticket. “This is a fantastic result for ‘smart voting’,” said Mr Navalny as the election results started to come in.

Besides the vote in Moscow, Russians also went to polling stations to elect the heads for 16 regions, as well as lawmakers for 13 regional parliaments. United Russia suffered a colossal defeat in the Khabarovsk region, in the country’s far east, where the nationalist Liberal Democratic Party of Russia (LDPR) was set to win 34 out of 35 seats in the local parliament.

There was better news for Mr Putin in the elections for governorships, where United Russia’s candidates were all reported to have triumphed in the first round. However, six of the incumbent United Russia governors ran as independents, including Alexander Beglov, the party’s boss in St Petersburg. Mr Beglov’s biography was removed from United Russia’s website ahead of the vote.

Dmitry Medvedev, Russia’s toothless prime minister, said the election results proved that United Russia remains the country’s biggest political force. He is correct. But Mr Putin’s foes will have scented a new vulnerability to the ruling party.