ISTANBUL – President Recep Tayyip Erdogan's party on Sunday was facing a defeat in local elections in the Turkish capital, Ankara, and possibly even Istanbul, its largest city, a result that shook the nation as Mr. Erdogan suffered the first major electoral retreat of his decade and a half in power.
The municipal balloting around the country came nine months after the national elections that extended Mr. Erdogan's hold on power. It was closely watched as a barometer of his standing with voters after the Turkish economy fell into recession and assumed sweeping new executive powers.
But for the first time in his political career, Erdogan was defending a defeat in Mayoral races in the center of Turkish political power, Ankara, and perhaps even in his hometown, Istanbul, the country's business center.
"Please do not be heartbroken with this result," he told supporters in an address. "We will see how they are going to administer."
All eyes were on the race for Mayor of Istanbul. Mr. 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 in fact won a substantial margin.
Rusen Cakir, a veteran commentator, said on Twitter that the turnaround was as historic as Mr. Erdogan's arrival on the political stage, when, as an Islamist and former political prisoner, he first won the mayor of Istanbul.
"The election today is as historic as the local elections in 1994," Mr. Cakir said. "It's the announcement of a page that was opened 25 years ago and is now closed."
Erdogan's candidate loses the Istanbul race, it would be a severe blow to his party, which after 17 years in power has been showing a decline in popularity.
"While losing Istanbul would be a nuclear defeat for Erdogan," said Soner Cagaptay , director of the Turkish Research Program at the Washington Institute for Near East Policy, "losing Ankara, which is a shorthand for political power and government, is a pretty significant loss."
In a sign of how seriously he considered these elections, Mr. Erdogan held up eight campaign rallies a day across the country, taking center stage in the municipalities, and he portrayed the vote as a matter of "national survival" and a chance to cement his administration "in perpetuity."
The declining economy was at the forefront of voters' concerns. After years of impressive growth, Turkey entered a recession in March. Unemployment 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 reported that Turkey has been depleting its international reserves to bolster the lira in the run-up to elections. Finance Minister Berat Albayrak promised to announce a package of new financial measures after the election, but investment confidence remains weak
"The campaign has shown Erdogan's desperation to win," said Asli Aydintasbas, senior fellow at the European Council on Foreign Relations . "He is vulnerable because of his declining votes."
While Mr. Erdogan remains the most popular politician in the country, his party failed to secure a majority in parliamentary elections in June and was forced into an alliance with the Nationalist Movement Party. A referendum in 2017 that gave him a sweeping new authority over the legislature and the judiciary was approved by just a narrow majority of Turks
Even pro-government newspaper columnists warned that corruption and cronyism in municipalities were turning voters away from the ruling party. Opinion polls showed that a larger percentage of voters than usual remained undecided right up to the election, which officials of his party took as a sign of unhappiness among the electorate
Opposition candidates offered change and promised to create jobs, improve education and bolster social services. And some were blistering in their criticism of Mr. Erdogan.
A former deputy prime minister to Mr. Erdogan, Abdullatif Sener, said that while the economy was tanking, Mr. Erdogan was building not only a second but also a third presidential palace, and spending millions to fly around on his presidential plane
. But the local votes for mayors, municipal councils and neighborhood administrators were seen as critical to Mr. Erdogan's grip on power
The municipalities represent the core of his working-class, conservative power base and source of income for his party, said Aykan Erdemir, a former member of Parliament and senior fellow at the Foundation for Defense of Democracy, and Research Institute in Washington.
Mr. Erdogan began his career as the mayor of Istanbul, and built his popularity on providing local services such as garbage collection and mass transport.
The president intervened personally in the Mayor of Istanbul, pushing his longtime ally Mr. Yildirim to run when the race promised to be close. He picked another former minister to run for Mayor of Ankara, the capital.
Mr. Erdogan also adopted a more negative tone on the campaign track than in previous elections. He threatened lawsuits, accused of criminality or terrorism, and whipped up nationalist anger at rallies. Conjuring up and clashing civilizations, he even played edited segments of a video of mass shooting at mosques in Christchurch, New Zealand.
On the economy, Mr. Erdogan told supporters that the municipalities had nothing to do with the downturn, and that he as president would handle economic matters. 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 with their party, known as AKP, were unlikely to make the leap to vote for the opposition alliance. But some voters in the AKP-held district of Uskudar in Istanbul said they were switching.
"We had enough," and middle-aged voter, Mustafa Topal, said after voting. "We've had enough of this robbery.
Younger people across the political spectrum have also voiced dissatisfaction, chafing at the lack of media freedom and the lack of job prospects, said Ms. Aydintasbas, the European Council fellow.
"I think this is a growing trend that you can not suppress," she said. "There is a second generation of young urban children who are not behaving like the AKP.
"They feel it is odd," she added, "to have Erdogan's picture all over town like a Central Asian republic, and every time you turn on the TV he's on. "