Ekrem Imamoglu, seen at the center from the back, the main Turkish opposition's candidate for Istanbul is surrrounded by cheering supporters as he visits the mausoleum of Mustafa Kemal Ataturk, the secular republic's founder, in Ankara, Turkey, Tuesday, April 2, 2019. Turkish President Recep Tayyip Erdogan's ruling party is appealing the results of the local elections in Istanbul, where the opposition has a razor-thin lead.(AP Photo/Burhan Ozbilici)

Ekrem Imamoglu, seen at the center from the back, the main Turkish opposition's candidate for Istanbul is surrrounded by cheering supporters as he visits the mausoleum of Mustafa Kemal Ataturk, the secular republic's founder, in Ankara, Turkey, Tuesday, April 2, 2019. Turkish President Recep Tayyip Erdogan's ruling party is appealing the results of the local elections in Istanbul, where the opposition has a razor-thin lead.(AP Photo/Burhan Ozbilici)

ANKARA, Turkey (AP) — Turkish President Recep Tayyip Erdogan’s ruling party on Tuesday appealed the results of local elections in Istanbul where preliminary results give the opposition a razor-thin victory, sounding confident that a recount will alter the outcome of the vote.

Nationwide, Erdogan’s conservative and Islamic-based party won a majority of votes in Sunday’s elections, but lost its decades-old stronghold of Ankara to the opposition and is trailing in the tight race for Istanbul. The results, which are pending the appeals process, were one of Erdogan’s most serious electoral setbacks in years.

ADVERTISEMENT

Bayram Senocak, the top official in Istanbul for the ruling Justice and Development Party, or AKP, told reporters he had filed appeals to challenge results in all of the city’s 39 districts. The party was seeking a recount to fix alleged irregularities as well as a reassessment of invalid votes.

Some 319,578 votes in Istanbul that were declared void “can affect the result of the election,” Senocak said.

The party is also contesting results in 25 districts in Ankara, said Hakan Han Ozcan who heads the AKP in the capital.

Ali Ihsan Yavuz, an AKP deputy chairman, called the elections “one of the most stained in our democratic history” — a claim the opposition Republican People’s Party, or CHP, quickly rejected.

“We won Ankara and Istanbul despite the fact that the conditions were not equal,” said senior CHP official Muharrem Erkek, in an apparent reference to the fact that the government-dominated media had hardly covered the opposition. The ruling party is also frequently accused of using state resources to campaign.

Erkek also accused the AKP of trying to win back the election “it lost in the ballot box” by trying to get the invalidated votes counted.

“You should know how to accept defeat with maturity,” he said.

The CHP said it had objected to results in 22 Istanbul districts where it claims its votes were miscounted. The party said its votes in Istanbul would increase by nearly 5,000 after a recount.

The district electoral boards have two days in which to consider the appeals.

Meanwhile, the opposition’s mayoral candidate for Istanbul, Ekrem Imamoglu, traveled to Ankara, to pay respects at the mausoleum of Mustafa Kemal Ataturk, the secular republic founder, where large crowds gathered to meet him, chanting “mayor Ekrem.”

Imamoglu garnered 48.8% of the votes, according to the results that have yet to be confirmed. His rival, former Prime Minister Binali Yildirim, took 48.5%.

Yildirim had declared victory on Sunday before acknowledging on Monday that Imamoglu was leading by some 25,000 votes.

Ankara and Istanbul have been held by the AKP and its Islamic-oriented predecessor for 25 years. Erdogan’s own ascent to power began as Istanbul mayor in 1994.

Mansur Yavas, the candidate of the opposition alliance, won 50.9% support in Ankara. The AKP’s candidate Mehmet Ozhaseki, a former environment and urbanization minister, won 47.1% support.