After a frenetic campaign with multiple daily rallies across Turkey, President Recep Tayyip Erdogan’s AKP lost the major cities including Istanbul in Sunday’s local elections, leaving the ruling party damaged but not beyond repair, analysts said.

Some said the losses suffered by the long-ruling party were mostly a result of last year’s currency crisis and an economic recession, the first in a decade.

But others pointed to the lacklustre candidates fielded by the Justice and Development Party’s (AKP) as well as declining support from Kurdish voters.

The AKP or its predecessors have held Istanbul and Ankara since 1994. Erdogan first rose to prominence as a successful mayor of Istanbul between 1994 and 1998.

The AKP came to power after the financial crisis in 2001 brought Turkey to its knees. In the years after, Erdogan was praised for the path he took to make the Turkish economy competitive.

Pundits took to saying that while the economy helped the AKP to win in 2002 it could as easily damage the party at the ballot box.

That is what happened on Sunday, losing not only Istanbul and Ankara but also Antalya, for a combined population of around 22 million out of 82 million nationwide.

“The economic crisis has really hurt voters, particularly the urban poor and lower middle classes that are AKP’s core support,” Berk Esen of Bilkent University said.

“Erdogan has drawn support from his base during the last few elections by promising that political stability would bring economic prosperity. Neither happened under his watch.”

Esen also said the candidates fielded by the AKP were “outshone” by opposition candidates including popular centrist mayors.

Emre Erdogan, a professor at Istanbul Bilgi University, said a key factor was the drop in support from Kurdish voters for the AKP.

“The aggregate numbers show that CHP [Republican People’s Party] candidates became successful in attracting the majority of voters” from the pro-Kurdish Peoples’ Democratic Party (HDP), not because of CHP policies but in reaction to the government’s “harsh policies” in Kurdish-majority cities.

After a two-year ceasefire collapsed, clashes between the PKK and Turkish security forces resumed, while Erdogan’s rhetoric against the HDP became harsher during the campaign, which experts say alienated many Kurdish voters.

How will Erdogan react?

Erdogan is “wounded because of Istanbul but he is very much alive,” said Ayse Ayata, a professor at Ankara’s Middle East Technical University.

Inside the Islamist movement that spawned the AKP, Esen said Erdogan “is effectively wounded”, which will “embolden his opponents within the movement”.

With inflation just under 20 per cent, unemployment rising and increasing concerns over the economy, Erdogan may focus on economic reforms since presidential and parliamentary elections are four and half years away.

This will be the longest period without any elections or referendums since 2002.

Erdogan could view Sunday’s results in Istanbul as “leading to a further decline”, Ayata said, pointing to weakening inside the party.

Esen said Erdogan’s hands were also “tied in the international arena due to the standoff with the US and the election results will further curtail his room for manoeuvre”.

Ankara and Washington are at odds over Ankara’s purchase of the Russian S-400 air defence system, which Washington warns will lead to sanctions and is incompatible with NATO technology.

How will parties be affected?

This was the first local election in which the AKP fielded candidates with its alliance partner, the Nationalist Movement Party (MHP).

With the loss of Istanbul, Ankara and Antalya, the AKP has lost control over big-budget cities, while holding on to 15 of 30 metropolitan municipalities and smaller districts across the country.

Strains could arise between the alliance partners, Esen said.

“MHP looks to be benefitting more than AKP from the AKP-MHP nationalist coalition. Erdogan may find himself without a potential ally at the national level, faced with a consolidated opposition and deep discontent in his ranks,” he said.

The CHP won municipalities from the AKP and the MHP, including Adana, Antalya and Mersin in the south.

For Ayata, the party’s success will be “motivation” but does not mean “absolute power”.

Erdogan of Istanbul Bilgi University – who is not related to the president – said the opposition including the CHP had to recognise that their victory was thanks in part to the Kurdish political movement and “develop policies to embrace them”.