ISTANBUL – President Recep Tayyip Erdogan's Sunday party faced defeat in local elections in the Turkish capital Ankara and possibly even Istanbul, its largest city, a result that shook the nation when Erdogan suffered the first major election setback of his decades and one half in power.
The municipal vote around the country came nine months after the national election that extended Mr Erdogan's holding power. It was closely monitored as a barometer of his standing with the electorate after Turkey's economy fell into recession and he assumed sweeping new executive powers.
But for the first time in his political career Mr. Erdogan defeats Mayor races in the center of Turkish political power, Ankara, and perhaps even in his hometown, Istanbul, the country's business center.
"Don't be so cordial with this result," he told supporters in an address. "We want to see how to manage."
All eyes were on race for mayor of Istanbul. Sir. Erdogan's candidate, former Prime Minister Binali Yildirim, was reported to be in a virtual tie with the opposition candidate, Ekrem Imamoglu. Mr. Imamoglu said he had actually won with a significant margin.
Rusen Cakir, a veteran commentator, said on Twitter that the turn was just as historic as Mr Erdogan's arrival at the political stage when he, as an Islamist and former political prisoner, first won the Istanbul championship.
"The election today is as historic as the local election in 1994," Cakir said. "It's the announcement of a site that was opened 25 years ago and is now completed."
If Mr. Erdogan's candidate loses the Istanbul race, it would be a serious blow to his party, which after 17 years of power has shown a decline in popularity.
"Even if you lose Istanbul, it would be a nuclear flag for Erdogan," says Soner Cagaptay, director of the Turkish research program at the Washington Institute for Near East Policy, "losing Ankara, which is shorthand for political power and government, quite a significant loss. "
On a sign of how seriously he considered these choices, Erdogan held up to eight campaign meetings a day throughout the country and took a central stage in the municipalities which he portrayed the vote as a" national survival "and a chance to cement its administration" forever. "
The falling economy was at the forefront of voters' concerns. After years of impressive growth, Turkey launched a recession in March. The unemployment rate is over 10 percent and up to 30 percent among young people. The Turkish lira lost 28 percent of its value in 2018 and continues to fall and inflation has reached 20 percent in recent months.
Investment analysts stated that Turkey had exhausted its international reserves to strengthen the lira during elections. Finance Minister Berat Albayrak promised to announce a package of new financial measures after the elections, but investment spending remains weak.
"The campaign showed Erdogan's desperation to win," says Asli Aydintasbas, a senior fellow of the European Council's Foreign Relations. "He is vulnerable because of his falling voices."
Mens Mr. Erdogan remained by far the most popular politician in the country, causing his party not to secure a majority in the parliamentary elections in June and was forced into an alliance with the Nationalist Movement Party. A referendum in 2017 that gave him sweeping new authority over the legislator and the judiciary was approved by a narrow majority of the Turks.
Even advocated newspaper colonists warned that corruption and cronyism in the municipalities turned voters away from the ruling party. Opinion polls showed that a greater percentage of voters than usual were undecided right up to the election, which officials in his party took as a sign of accident among voters.
Resistance candidates offered change and promised to create jobs, improve education and strengthen social services. And some blasted in their criticism of Mr. Erdogan.
A former Deputy Prime Minister of Erdogan, Abdullatif Sener, said that while the economy was fueling, Mr. Erdogan not only a second, but also a third president's palace and uses millions to fly around on his presidential plane.
Municipal elections usually draw a little message outside Turkey. But the local voices for mayors, municipal councils and neighborhood administrators were considered critical to Mr Erdogan's grip on power.
The municipalities are at the heart of his working class, conservative power base and a source of income for his party, said Aykan Erdemir, a former parliamentarian and a senior scholar at the Institute of Democratic Defense, a research institute in Washington.
Mr. Erdogan began his career as mayor of Istanbul and built his popularity in providing local services such as garbage collection and mass transport.
The president personally entered the race for mayor of Istanbul and pushes his longtime ally, Mr. Yildirim, to run when the race promised to be close together. He chose another former minister to run for mayor in Ankara, the capital.
Herr. Erdogan also adopted a more negative tone on the campaign track than in previous elections. He threatened litigation, charged with opposition to crime or terrorism, and whipped up nationalist anger at the rally. He lamented civilizations and even played edited parts of a video of mass shooting in the mosques of Christchurch, New Zealand.
On the economy Mr. Erdogan advocates that the municipalities had nothing to do with the downturn and that he, as president, would handle economic conditions. In the weeks before the vote, the government set up municipal stalls to sell cheap vegetables to combat rising prices.
Most political analysts had predicted that they were dissatisfied, but that their followers, known as the AKP, were unlikely to make the leap vote for the opposition alliance. But some voters in the AKP-held district of Uskudar in Istanbul said they were changing.
"We had enough," said a middle-aged voter Mustafa Topal after voting. "We had enough of this robbery. The system of ransacking led to my change."
Younger people across the political spectrum have also expressed dissatisfaction, chafing due to lack of media freedom and lack of job prospects, said Mrs Aydintasbas European Council Fellow.  "I think it's a growing trend you can't suppress," she said. "There is another generation of young urban children who do not behave like AKP. They have longings that do not differ from the kids on the other side of the tracks."
"They feel it's strange," added she, "having Erdogan's image all over the city as a Central Asian republic, and every time you turn on the television he is on."