Despite ruling Turkey with an iron fist and a crackdown on opposition figures and free press in recent years, President Recep Tayyip Erdogan’s Justice or Development Party – known as AKP – was delivered a surprise blow in local elections this week.

While the country still awaits official results, unofficial data – as reported by the state-run Anadolu Agency on Monday – indicate that Erdogan’s partners have likely lost mayoral elections in the three major cities of Istanbul, Izmir and the capital Ankara.

However, the AKP’s secretary-general announced on Twitter Monday that they will be contesting the results of Istanbul and Ankara, citing voting irregularities.

PENTAGON STOPS DELIVERIES OF F-35 PARTS, MANUALS TO TURKEY OVER PURCHASE OF RUSSIAN AIR DEFENSE SYSTEM

Initial, albeit unconfirmed results on Monday, showed that Republican People’s Party (CHP) candidate Ekrem Imamoglu took a nailbiter in the economic center and most populous city of Istanbul, edging out the AKP opponent Binali Yildrin by just .3 percent.

Meanwhile, CHP’s secular Mansur Yavas is so far documented to have defeated AKP’s Mehet Ozhaseki 50.9 percent to 47.2 percent in Ankara; and in Izmir, the results so far point to CHP’s nominee Mustafa Tunc Soyer at 58 percent as AKP’s contender Nihat Zeybekci lingers at 38.5 percent.

All votes have reportedly been counted in those cities. And voter turnout was high, with more than 85 percent of the 57 million registered leaving their mark at the ballot box.

“Essentially, the outcome of the election has been a long time in the making,” Kamran Bokhari, Director at the Center for Global Policy in Washington and a Non-Resident Scholar at the Arabia Foundation, told Fox News, noting that a number of factors may be contributing to Erdogan’s popularity dip. “Being in power for too long; declining economic conditions, autocratic nature of his rule, and sidelining of many allies.”

He pointed out that while the Turkish President “remains powerful because his AK Party controls all three branches of the Turkish state,” it is “in the process of losing the dominant position it has held for sixteen years.”

AHEAD OF VOTE, TURKEY'S ERDOGAN SAYS US ATTACKING ECONOMY

Aykan Erdemir, a senior fellow at the Foundation for Defense of Democracies and former Turkish parliament member, concurred that “Erdogan still has a solid group of loyalists who have so far stood with him despite the economic crisis.”

“But at the same time, he has just lost Turkey’s leading municipalities, which will severely limit his ability to offer spoils to his clients,” he explained. “This will have a corroding effect on his patronage networks and party. As the economic crisis deepens, he will have a hard time preventing his followers from defecting to other parties. This could be the beginning of the end of Islamist politics in Turkey, but it will be a long and painful process.”

Supporters of the Republican People's Party, CHP, wave Turkish flags, and one with a portrait of Kemal Ataturk, right, as they celebrate after preliminary results of the local elections were announced in Ankara, Turkey, early Monday, April 1, 2019.  (AP)

Sunday’s vote was the first time municipal elections were held in Turkey since Erdogan cemented his 16-year rule with even more executive powers in a presidential election last year. To many, he and AKP – which has been victorious in every election since 2002 – seemed unconquerable.

Much of the grievances among the Turkish people have centered on the country’s ailing economy, which has steadily diminished under Erdogan’s policies. The Turkish lira tumbled more than 28 percent in value last year alone, with little sign of improvement, as inflation stands at 20 percent and unemployment over 10 percent. Last month, it reached the point of a recession.

At least four deaths were recorded ahead of the vote, and scores of fights were reported by local news outlets.

GET THE FOX NEWS APP

While unofficially losing the major cities, the AKP-led alliance still came out on top overall taking 51 percent of the vote, according to the BBC.

“If there are any shortcomings, it is our duty to correct them,” Erdogan told crowds on Sunday night.