Turkish President Recep Tayyip Erdogan and his ruling AKP party have suffered a surprise blow in municipal elections across the country, amid a major economic crisis that continues unabated.
With control over the biggest cities lost, what does this dramatic defeat mean for Erdogan?
The main opposition Republican People's Party (RNP) won 37,8 percent of the vote nationwide, according to Anadolu Agency, compared to 35,5 percent for the AKP.
Many experts declared these elections "Erdogan's heaviest defeat of all time".
The RNP not only managed to defeat the ruling AKP nationwide for the first time since President Erdogan came to power 21 years ago, but also achieved the highest national result in decades.
How did that happen?
- Elections in Turkey: A slap to Erdogan, Istanbul and Ankara against him
- What the defeats of Erdogan in Istanbul and Ankara mean for the politics of Serbia and the region
- Recep Tayyip Erdogan: The bagel seller who changed Turkey
- The man who brought down Erdogan
Economic woes: Hyperinflation and discontent
The severe economic crisis in Turkey became a key factor in the defeat of the ruling party.
Unlike many other countries, whose cost of living crisis began in 2022 with the war in Ukraine, the beginning of Turkey's current problems has its roots in 2018.
Inflation exceeded 65 percent, and the national currency, the lira, lost more than 80 percent of its value in five years.
The Turkish government under Erdogan's leadership is often accused of being out of touch with the difficult lives of ordinary people.
"The ruling AKP is too late to appreciate the catastrophic consequences of the economic crisis," H. Bahadir Turk, professor of political science at Haji Bajram Veli University in the capital Ankara, told the BBC.
He adds that the victory in the presidential elections in 2023 made Recep Tayyip Erdogan and his AKP "too optimistic in solving the crisis".
"I think this is the biggest mistake made by the AKP and Erdogan," says Professor Turk.
Watch the BBC documentary about two decades of Erdogan's rule:
The crisis and the high cost of living featured prominently in the opposition's campaign.
"This country does not deserve poverty," became one of the constant slogans of Ekrem Imamoglu, the popular current mayor of Istanbul, who was running for re-election against the AKP candidate.
He managed to secure another five years in power after a landslide victory on Sunday.
Imamoglu, the RNP candidate, accused Erdogan of "turning the economic rules upside down."
In 2023, Erdogan managed to win a third term in power with promises of economic recovery.
But in the local elections of 2024, say insiders, the voters wanted to send a message not to Erdogan personally, but to the entire ruling party.
"Voters do not easily give up their emotional connection with rulers. In the local elections, they did not have to vote for the leader Erdogan, but for his party.
"And in these elections, they wanted to send a message of dissatisfaction with the AKP," Evren Balta, professor of political science at Ozjegin University in Istanbul, told the BBC.
The growing appeal of the opposition
The main opposition party, the Republican People's Party, retained power in Turkey's largest cities, including Istanbul, Ankara and Izmir, and gained control in several new ones, such as the fourth-largest city of Bursa.
The party has swept through traditionally conservative central Turkey in what many commentators have described as a "red wave," referring to the color used to mark the CHP's advance on maps and charts.
Founded by the founder of modern Turkey, Mustafa Kemal Ataturk, the RNP is a secularist and nationalist party.
Its main stronghold is in the urban middle class.
Since the founding of the modern Turkish republic, conservatives and devout Muslims have perceived the RNP as a threat to their values of fairness and devotion to religion.
The CHP, in turn, has often accused conservative political groups, including the AKP, of pursuing Islamist goals.
Polarization between religious and secular communities has dominated Turkish politics for decades.
But in recent years, the RNP has broadened its base to include more conservative and religious residents, which contributed to this latest election victory.
"Since 2017, after the 2016 coup attempt in Turkey, the RNP has been following a political strategy of reconciliation with the conservatives, with the intention of ending polarization," says Professor Balta.
In Istanbul, one of the key factors for the re-election of RNP candidate Imamoglu was the support of the Kurdish community, despite the fact that there were candidates nominated by the pro-Kurdish DEM on the ballot.
Professor Balta says that the Kurdish community voted strategically.
"On the one hand, you have the AKP, a serious player, calling them a 'terrorist group.'
"On the other hand, you have Imamoglu who treats the Kurds as equal citizens. And that's why they made a rational choice by voting for him," she says.
Another factor that helped the opposition in this election was that the messages reached the voters during the campaign.
Although most media in Turkey are controlled by pro-government agencies, this control is not absolute.
Critics often accuse Erdogan of media monopoly and imposing authoritarian rule.
But Professor Balta from Ozjegin University in Istanbul says that authoritarianism can manifest itself at different levels.
"Control over the media or political parties in Turkey has never been like in Russia, and it never will be. There is still significant political competition and opposition here.
"And they had the instruments and the opportunity to communicate with people."
Watch the video: How Turkey has changed under Erdogan's rule
Is this the end of President Erdogan?
Although this is a significant defeat for Erdogan and the AKP, analysts believe that it is too early to talk about the end of his political reign.
Erdogan's presidential term expires in 2028.
In the weeks leading up to the March 31 election, he said it would be his last term, referring to his standing under the constitution.
"Even though these elections were exceptional for the opposition, Erdogan still dominates Turkish politics, and his influence is still significant," says Professor Turk from Haji Bajram Veli University in Ankara.
"We mustn't forget that for the majority of voters in Turkey, he is a very respected and loved personality, who serves as an example."
Professor Turk believes that the success of the AKP depended on the harmony between "Erdogan's charismatic authority and the party's bureaucratic functioning".
"But I think that harmony is gradually being broken, and the results of these local elections are an indication of that."
The re-elected mayor of Istanbul, Ekrem Imamoglu, is now considered a serious contender for the presidency, although he has not yet officially announced that he will run.
Professor Balta believes that by retaining the mayoral position in Istanbul, Imamoglu increased the potential of his own candidacy.
During the two years of his reign, President Erdogan's political influence did not remain within the Turkish borders.
He presented himself as the main mediator between Russia and Ukraine, reaching through negotiations an important agreement on grain exports in 2022; he strengthened Turkish trade relations with many countries in Africa and Asia, and was an influential figure throughout the Middle East.
According to analysts, such a big defeat in the local elections could threaten "his legitimacy in the world."
"Imamoglu promises a functional democracy. We could see in the future how the opposition strengthens financial, cultural and political ties with world powers," says Professor Balta.
Although it does not represent the end of Erdogan's rule, this election result represents a serious erosion of his authority.
He said: "31. March is not the end for us, but a turning point."
Erdogan has promised to work hard to win back the loyalty of supporters.
But the opposition, strengthened by these latest election results, will use the momentum to expand its influence beyond the municipalities and assert itself as an alternative political force.
Follow us on Facebook, Twitter, Instagram, YouTube i Viber. If you have a topic proposal for us, contact us at bbcnasrpskom@bbc.co.uk
Bonus video: