Turkish President Recep Tayyip Erdogan’s Justice and Development party lost control over the capital Ankara in local elections held on Sunday, Reuters reported. In Istanbul, which is Turkey’s largest city, Erdogan’s party and the Opposition have claimed to have won the mayor’s seat, according to BBC.

In Ankara, an opposition bloc led by mayoral candidate Mansur Yavas ended the Justice and Development Party’s or AK Party’s 25 years of dominance over the capital, according to The Guardian.

In Istanbul, Ekrem Imamoglu, who is the candidate for the opposition Republican People’s Party-led Nation Alliance, said he had won by nearly 28,000 votes over the Justice and Development Party candidate and former prime minister, Binali Yildirim. Minutes later, the AK Party provincial head in Istanbul said Yildirim had won by about 4,000 votes.

Across the nation, the People’s Alliance – which is comprised of the ruling AK Party and the Nationalist Movement Party – had secured 51.7% of the votes, with 91.7% provincial votes counted, according to Al Jazeera. It was followed by Nation Alliance, with 37.6% votes.

Elections to choose mayors for 30 major cities, 51 provincial capitals and 922 districts were held in Turkey on Sunday.

Erdogan has dominated Turkish politics since coming to power 16 years ago. He had campaigned relentlessly for two months ahead of Sunday’s vote, which he described as a “matter of survival” for Turkey.

“Every gain and every loss is the will of our people and also a requirement of democracy that should be acknowledged,” Erdogan said, according to The Guardian. “We will admit we won the hearts of our people in areas that we won and we will admit we were not successful enough in areas we lost.”

The elections were a challenge for Erdogan as the country is faced with high inflation and rising unemployment caused by a currency crisis last year. Erdogan said he would focus on implementing a “strong economic programme” without compromising on free-market rules.