As Turkey's president, Tayyip Recep Erdogan is supposed to be the invisible man in the upcoming general election, constitutionally bound to remain above the fray. Instead, it's been all about him.

The overarching drama of the election has been whether Erdogan's Justice and Development Party, or AKP, will win a strong enough majority to change the constitution and put Erdogan at the unquestioned pinnacle of Turkish politics in a new presidential system.

But the chances of an AKP landslide appear to be fading, and the surge of the country's main Kurdish party could effectively block the 61-year-old Erdogan from achieving his ambitions. If the pro-Kurdish People's Democratic Party, or HDP, reaches the threshold of 10 percent of the total vote required to take seats in parliament as a party, it would likely make it impossible for AKP to reach the supermajority in parliament required to call a referendum on constitutional change.

Erdogan took a big gamble when he announced last year that he would seek the presidency in the country's first direct vote for the largely ceremonial post, rather than lead his party into the election as premier. He bet that after moving into the presidential palace, he could then make the position powerful with an expanded majority in parliament. That now looks to have been a rare miscalculation for a man who has dominated Turkish politics since his party came into power in 2002. 

Rather than sit back and watch, Erdogan has thrown himself into the campaign, remaining ubiquitous in the political conversation, on television and at political rallies thinly disguised as part of his presidential duties. Prime Minister Ahmet Davutoglu, the putative campaigner-in-chief, has been a pale shadow in comparison.

"I am at an equal distance to all parties, but of course there is a party that is close to my heart," Erdogan said in rally after rally as he led a fierce campaign, shrugging off criticism that he is in breach of constitutional impartiality.

An increasingly authoritarian leader who shows little tolerance to the mildest of criticism has himself poured scorn upon the opposition, calling its leaders clowns and fascists, and accusing Kurdish party leaders of terrorism. He has waved the Quran at rallies despite laws against using religion in campaigning.

"Erdogan does not want to leave his political future and his 'cause' at the hands of Davutoglu," said Ihsan Dagi, professor at Ankara's Middle East Technical University. "Erdogan sees himself as the chosen one to build a 'New Turkey.'"

Under leader Selahattin Demirtas, an amiable 42-year former human rights lawyer, the HDP has expanded its appeal beyond Turkey's Kurdish regions, attracting leftist and liberal voters in the rest of Turkey. The party used to field less than 40 independent candidates for parliament to circumvent the 10 percent rule, but is now running as a party in a bid win between 60 and 70 seats and thwart Erdogan's ambitions.

"People think that we're the only ones who can block Erdogan's stance of unlimited power and what he calls a 'presidency,' but what we call 'dictatorship,'" Demirtas told The Associated Press in an interview.

There are fears that an HDP failure to pass the threshold could derail a two-year old peace process with Kurds aimed to end three decades of violent conflict. Erdogan, who initiated the peace process, has meanwhile hit the brakes on the talks, over apparent concerns of losing nationalist votes to the far-right MHP party, which is strongly opposed to concessions to Kurdish rebels, considered a terrorist organization by the government and some allies such as the United States.

After 13 years of rule, the AKP is entering the elections beset by problems, including a weaker economy and high unemployment. Its image has been tarnished by a vast corruption scandal and a harsh response to nationwide anti-government protests in 2013 that were sparked by opposition to plans to knock down Istanbul's Gezi Park. More recently, Erdogan and other officials have been criticized for their lavish spending, including a new 1,150 room presidential palace that critics point to as evidence of Erdogan's alleged pharaonic tendencies.

"The Gezi Park protests, the corruption allegations and the expenditures have formed a breaking point for the AK Party's public support," said Ozgur Unluhisarcikli, who heads the German Marshall Fund in Ankara. "However, we do not know to what extent this translates into votes."

This time, the secular, main opposition CHP party is running on a bold economic agenda, with promises to fight unemployment and improve pensions and farmer's conditions, as well as improved democracy and freedoms — but risks losing supporters to the HDP.

"This is the first time in many years that the CHP is campaigning on issues that matter, rather than on ideology," Unluhisarcikli said, adding that it remained a question whether that would boost the party's support.

Erdogan says the parliamentary system limits Turkey's prospects for a growth leap that would make it one of the world's top economies in the next decade. He has not outlined the presidential system he has in mind, but critics fear it would be devoid of checks and balances and lead to one-man rule.

"Turkey will either move toward authoritarian rule or it will choose democracy," CHP leader Kemal Kilicdaroglu told The AP.

Erdogan's die-hard supporters are not troubled.

"We stand beside (Erdogan), in everything," said AKP supporter Halil Akar in Istanbul. "We want the constitution to change, we want the presidential system."

__

Butler reported from Istanbul. Ayse Wieting and Berza Simsek in Istanbul also contributed.

__

Follow on Twitter: Desmond Butler at https://twitter.com/desmondbutler and Suzan Fraser at htttnps://twitter.com/suzanfraser