Strongmen are not invincible. The stunning news that the Turkish opposition had surged to victory in local elections – as startling to the opposition itself as anyone – is on hold following objections from the ruling AKP. In the coming days, the final results will be announced. Legal proceedings are likely; a concerted media attack on the expression of the democratic will as a “coup at the ballot box”, under malign foreign influence, is already under way.

But whatever happens next, there is no doubt about the blow dealt to Recep Tayyip Erdoğan, the country’s authoritarian president, after 16 years at the helm. He has asserted the legitimacy of his increasingly repressive rule on the basis of his success at the ballot box. He did more than anyone to inflate the stakes and personalise this contest. He called it a matter of “national survival”, portrayed opponents as traitors and terrorists, and held up to eight rallies a day. Now the public has delivered its verdict. Though the AKP won most votes, the apparent loss of the major cities, on an 84% turnout, has sent the clearest of messages.

Initial results easily delivered the capital, Ankara, to the secular CHP opposition. Narrower, but much more humiliating, is its success in Istanbul – not only the country’s cultural and economic powerhouse, but Mr Erdoğan’s birthplace and stronghold, where he entered national politics as mayor 25 years ago. Now, the relatively unknown Ekrem İmamoğlu has declared himself its new mayor (despite the AKP’s disagreement) and is being touted as a potential presidential candidate for 2023. He won votes by reaching across the divides, instead of working to widen them.

Mr Erdoğan’s alarming political instincts and beliefs are matched by his consummate political skills. He rode out the Gezi Park protests of 2013, and used the failed coup attempt of 2016 to launch mass purges of the country’s institutions, before pushing through constitutional changes that handed him sweeping new powers. Last year, he won another five-year term in snap elections. He has enfeebled the judiciary. Scores of journalists are jailed on anti-state charges and his cronies control the media, ensuring his party utterly dominates coverage.

But the costs of his populist campaigning and policies in government are becoming clearer. His use of footage from the Christchurch mosque attacks at rallies caused international revulsion, and his rhetoric triggered another plunge in the Turkish lira. Relations with the US continue to deteriorate; last week, Washington halted delivery of equipment related to its F-35 fighters because of Turkey’s planned purchase of a Russian missile defence system.

Inflation stands at 20% and nearly one in four young people are unemployed. Lavish megaprojects such as the new Istanbul airport – now expected to cost £6bn – look less like an achievement and more like part of the problem. A more organised and coordinated opposition seized on the opportunity. The opposition’s control of cities could give it a chance to show it can deliver on promises, as well as whittle away at the president’s powers of patronage. The real importance of these elections, however, is their symbolism. The initial results alone constitute a humbling warning to a man who abandoned humility long ago. But with this opportunity comes the great danger that he will simply ignore the results and arrange the outcome to suit his purposes. Up till now he has ruled as an authoritarian populist. He could morph into something worse.