Supporters of Turkey's ruling Justice and Development Party (AKP), who stayed up late into Sunday night to hear the first election results were rewarded with that rarest of occurrences: a speech by a chastened Recep Tayyip Erdogan. For many years, Mr Erdogan has always been on the winning side of a popular vote. On Sunday, he still was – but just barely. Turkey's local elections dealt him and the AKP a series of shocking <a href="https://www.thenational.ae/world/europe/turkish-president-erdogan-s-party-loses-ankara-and-istanbul-in-bruising-local-vote-1.843781">defeats</a> across the country, including the loss of the capital Ankara and, so it appears, that of Istanbul, the nation's largest city. Addressing crowds in the early hours of Monday morning as the results came in, he said the party had lost because “we couldn't express ourselves to our nation and we failed to win their hearts”. That is as close to an admission of culpability as the bombastic Mr Erdogan has come in his 16-year rule. And yet the results, while bad for Mr Erdogan, were not much better for his opponents. On a night of winners and losers, neither the AKP nor the opposition Republican People's Party (CHP) can comfortably claim to be completely in one camp or the other. Local elections inevitably become coloured by the electorate's feelings about the president, especially when the president has been in power, in various guises, as long as Mr Erdogan. But if Turkish voters decided the election was really an opportunity to offer their <a href="https://www.thenational.ae/world/mena/turks-vote-in-test-for-recep-tayyip-erdogan-as-recession-hits-home-1.843299">verdict on Mr Erdogan</a> himself, he has only himself to blame. After all, he put himself front and centre on the campaign trail, warning that the elections were a matter of the <a href="https://www.thenational.ae/world/europe/competing-with-erdogan-turkey-s-local-elections-touched-by-national-issues-1.842918">country's "survival"</a>. He was there on the posters next to the AKP candidate Mehmet Ozhaseki in Ankara and, in Istanbul, beside Binali Yildirim. The AKP was roundly defeated in the capital, but is disputing the result in Istanbul, which it appears to have lost by a slimmer margin. Even if the party was to eventually retain the city, it is still a failure to have come so close to losing it – and a deeply personal one for Mr Erdogan, whose political career began as its mayor. The results, then, are bad news for the AKP and its leader, and suggest that both the aura of invincibility that Mr Erdogan has projected and his grip on the national imagination are fading. And yet, if his opponents think they have in some way summited the mountain of public opinion and can now cruise to victory at the next election, they have misread the polling data. If this election has shown the limits of Mr Erdogan's personal influence, it has also shown the limits of the opposition's ability to win hearts and minds. Look again at the facts of the election. Turkey is led by a president and a party that have been in power since the turn of the century. The country is in recession, with inflation in double digits and unemployment at a nine-year high. It is engaged in a war to the south, and there are millions of Syrian refugees within its borders, making life hard in those areas where AKP support is often strongest. All of these are political issues that in most democracies would provide powerful weapons to attack the incumbent party and president with. And yet in the midst of all of this, the best the opposition can do is just dent Mr Erdogan's appeal. Worse, they cannot even claim that the opposition vote was split. Look at the emerging electoral map. In some seats, the CHP contested the election in alliance with the Iyi party. Yet, even taken together, their combined share of the vote (37.56 per cent) is still considerably less than the AKP's share (44.31 per cent). Add in the right-wing Nationalist Movement Party (MHP), with which the AKP joined forces in some seats, and the split of the two alliances is 51.62 per cent vs 37.56 per cent, in favour of Mr Erdogan. Those are not numbers that herald an imminent election victory for Mr Erdogan's opponents. The real question for the opposition, once the celebrations in Ankara end, is why they have done so badly. Yes, the CHP managed to take metropolitan areas around Ankara and Istanbul, and most of the mayoral seats along the Mediterranean coast. But the vast regions of Anatolia and along the Black Sea went overwhelmingly to the AKP and its allies. That should provoke much soul-searching in what is, after all, the party of Mustafa Kemal Ataturk. If the CHP is intent on once again becoming a national party and taking the presidency, it will have to capture voters beyond the cities and the coast. In any case, there is sufficient time to plan. Turkey has until 2023 before presidential and parliamentary elections are held. To stand a chance of unseating the AKP by then, the opposition will have to find a powerful political message and a charismatic bearer of it. This week, the opposition finally placed a roadblock in the path of the electoral juggernaut that is Mr Erdogan’s AKP, but still failed to halt it.