Sunday’s local elections in Turkey resulted in a major setback for the president, Recep Tayyip Erdoğan, and his ruling alliance. The ruling Justice and Development party (AKP) and nationalist MHP coalition lost Turkey’s major cities to an opposition ushering in an era of change at the local level. The political transitions in Istanbul and Ankara are critical given that these cities have been held by Erdoğan’s political “family” tradition since 1994. The loss in Istanbul (now subject to a challenge by the AKP) is also laden with symbolism since the city is linked with Erdoğan’s ascendance to the pinnacle of political power in Turkey. He entered national politics as the young and promising mayor of Istanbul, winning a tight municipal race 25 years ago. So the question is how a hitherto invincible leader and political movement has lost its footing, having been able to consolidate power for such a long time.

The first explanation has to do with the state of Turkey’s economy, which has in many ways proved to be the best friend of Turkey’s democracy. The elections were held against the backdrop of recession, the first in the country for a decade. Households had started to suffer from the impact of last summer’s currency crisis, which led to higher inflation and eroded standards of living. The economic slowdown has dented employment prospects, with general unemployment inching up to 14% in November and youth unemployment to 24%. Unlike some authoritarian jurisdictions, Turkey is not a rentier state that can rely on commodity revenues to buy the political loyalty of its citizens. Turkish governments have to create the conditions for a well-functioning and stable market economy in order to satisfy the aspirations of the electorate. Any longstanding departure from the principles of good governance – which includes the degradation of the rule of law, transparency and accountability, as well as political and economic freedoms – will exact first an economic and then inevitably a political price. That is the shock that came to the surface last Sunday.

Turkey may be the spark that lights a fire in the world economy | Larry Elliott Read more

The second explanation relates to a dramatic change in the performance of Turkey’s long-belittled opposition. This time, the opposition managed to outmanoeuvre Erdoğan and his party. Firstly, the centre-left CHP and nationalist/centre-right IYI party alliance performed better than the government alliance in terms of voting behaviour. In places where there was a joint candidate with a CHP background, the IYI party electorate voted wholesale for the CHP, and vice versa. In contrast, the MHP constituency was divided in its support for AKP candidates, especially in the metropolitan areas of western Turkey. The opposition alliance also received a strong boost from the tactical voting of the pro-Kurdish HDP electorate.

Even more important, however, were the candidates themselves. Both in Ankara and Istanbul, the opposition fielded candidates that were willing and able to reach out beyond their core and natural constituencies. In Ankara, Mansur Yavas got a majority of the nationalist vote. In Istanbul, Ekrem Imamoglu was able to draw a share of the conservative vote. He consolidated his image as an emerging leader with his astute management of the crisis the night of the election when the AKP candidate, the former prime minister Binali Yildirim, declared victory prematurely.

The consequences of the opposition’s victory in these local elections will be significant. But they have to be placed in the right context – which is that, despite this setback, Erdoğan and AKP remain the dominant force in Turkish politics. On Sunday, the government alliance received 51% of the national vote. But victory at these municipal elections will embolden the political opposition. It stands to benefit from controlling local governments in Turkey’s economic heartland.

The opposition is now in command of the cities that make up 65 % of the nation’s GDP. Its immediate challenge is to match and outperform the service delivery standards achieved by AKP local governments over the past decades. In the longer term, it will need to cement its alliance at the national level, something that will be facilitated by a more inclusive model of local governance including merit-based staffing policies to replace the ideology-based patronage of the AKP years.

For Erdoğan, the challenge will be to overcome the perception of weakness in the wake of a major electoral loss. His immediate concern will be the shape of the economy. His political fortunes will depend on how soon he can return Turkey to a path of sustainable growth. The risks are not negligible given that superficial steps will no more suffice. Deep reforms tackling Turkey’s democratic deficit and rule of law will also be needed.

Local elections have demonstrated that despite having achieved a remarkable degree of power centralisation, Erdoğan and the AKP remain vulnerable to economic and political undercurrents, just as should be the case in a normal democracy. So in many ways, the winner on Sunday was the image of Turkey’s polity, both at home and abroad. Despite being saddled with big problems, Turkish democracy demonstrated its resilience and vibrancy, and hinted at a future beyond populist and divisive politics.

• Sinan Ülgen is the executive chairman of the Istanbul based EDAM thinktank and a visiting scholar at Carnegie Europe