The fits and agitation exhibited by Turkish President Recep Tayyip Erdogan and the ruling Justice and Development Party (AKP) are a reaction to the shock delivered by the results of the 31 March local elections. The ruling party lost not just the capital, Ankara, but Turkey's most important metropolises. The hardest blow came from Istanbul, the country's economic capital and the city with the largest and most demographically diverse population. The city that straddles the Bosporus is home to inhabitants from all Turkish provinces, all political parties and all ethnicities. It is little wonder that they say, “whoever governs Istanbul, governs Turkey.” This helps explain the tenacity with which the AKP has challenged the election results in this city, above all. On Tuesday, the AKP vice president announced that the party would “file our extraordinary appeal today. We will say that there have been events that directly impacted the outcome of the elections and that we demand the renewal of the elections in Istanbul,” Vice Chairman Ali Ihsan Yavuz told a press conference in Ankara. It was Erdogan, himself, who in the run-up to the polls described the local elections as vitally critical. This may have been to spur supporters, but he, personally, hit the campaign trail as though it were a matter of life and death. For two months, the Turkish president travelled from one city to the next, addressing a campaign rally per day and sometimes two rallies in different cities on the same day. Huge pictures of him proliferated on billboards everywhere as though Turkey were headed for another presidential election as opposed to elections to choose governors, mayors, municipal board members and neighbourhood mukhtars. Moves to appeal the results were not the only indicator of the government's anxiety. Another is to be found in an escalation of the air of suspicion surrounding the results, to the extent that they have been likened to the July 2016 coup attempt against Erdogan. Some pro-Erdogan newspapers went so far as to say that the municipal elections accomplished what the coup attempt could not. Behind this rhetoric danger lurks. It appears that local elections were indeed critical. They marked a turning point in several respects, the most significant at the level of the democratic process. Erdogan rose to power, became president and won a parliamentary majority through democratic means. But, after the coup attempt, he hacked away at democracy with sweeping purges of the judiciary, universities and other once independent institutions, and with wave after wave of arrests of intellectuals, journalists and even opposition members of parliament. But the severest blow came with the transformation to a presidential system by means of a constitutional amendment that passed a referendum by a hair. That narrow win was, in itself, a warning of the sharp polarisation that is cleaving Turkish society as the country moves inexorably in the direction of one-man-rule. But the intransigent Erdogan sees only himself. Even the recent local elections, to him, were a referendum on his person. This is why he felt the enormity of the loss all the more acutely, especially the loss of Istanbul, the staging point for his rise from city mayor to president. The pro-Erdogan newspapers and TV pundits have sustained a steady stream of vilification against the opposition Republican People's Party (CHP). They accuse it of allying with “terrorists” because of the support it received from the Kurdish Peoples Democratic Party (HDP) which the pro-AKP media casts as being in cahoots with the Kurdistan Workers Party (PKK) which has been branded as a terrorist organisation in Turkey and elsewhere. The CHP has been labelled “terrorist” by extension. This is another ominous sign for the future of democracy in Turkey. The regime has set in motion a slander campaign against the major opposition party and its leaders, putting them under siege in the cities in which they beat the AKP in the polls. In fact, the AKP's real crisis is that Erdogan cannot tolerate anyone by his side strong enough to steal some of the light. One by one he has eliminated influential, experienced and popular colleagues and aides, not least of whom were former president Abdullah Gul and former prime minister Ahmet Davutoglu. Today, however, if Erdogan attempts to engineer a sweeping change within the ruling party, he might precipitate a schism and the rise of a new party headed by one of the AKP pillars that Erdogan had elbowed out of his way. Such a party would be a formidable rival and drive a nail into the coffin of the ruling party. Erdogan will have to contend with a number of challenges in the upcoming months, the most important of which is the country's profound economic crisis. He has tried various ways to prevent the crisis from worsening but to no avail. Stringent fiscal measures have failed to halt the slide of the lira against the dollar. One message of the results of the municipal polls is that the Turkish people are unwilling to tolerate further erosion of their standards of living. But Erdogan's alternatives are limited. He will probably have to turn to the IMF and yield to its pressures and conditions. The EU, for its part, is unlikely to feel as generous towards Erdogan as it had at the outset of his rule. In all events, even if Germany and France do not want to see the Turkish economy collapse, the EU has its own financial troubles, to which testify the economies of France, Spain, Italy and Greece. Economically, Erdogan has some tough choices to make. A second major challenge relates to Ankara's deteriorating relationship with the US. Very soon, Erdogan is going to have to choose between Russia's S-400 missiles and the US's F-35 fighter jets. If he insists on continuing with the purchase of the former, he may risk losing more than the latter. There have already been intimations of the possibility of Turkey's expulsion from NATO. Again, his choices are limited. He can continue to dig in his heels or bide his time until the next elections or escalate his defiance by drawing closer to Russia, China and Iran. Yet, the path to the Russian heart is not strewn with roses. Moscow will insist he meet two demands: the first is to disarm the terrorist groups in Idlib and the second is to abide by the Russian plan for solving the crisis east of the Euphrates. The upshot of both would be to restore control over the whole of northern Syrian territory to the Syrian army.