RIDING on robust growth and democratic reforms, Turkey’s pro-Islamist Justice and Development (AK) party has won three terms in power since 2002. With parliamentary elections due on June 7th, its secular rivals gloomily thought that AK was poised for another victory. That was until Bulent Arinc, the government spokesman and a founding member of the party, let rip at his leader.

Over the past week, Mr Arinc has been doing what no AK official had ever dared: publicly castigating Turkey’s autocratic president, Recep Tayyip Erdogan. Mr Arinc called his fellow AK founder “emotional”, and said he had harmed himself by criticising peace talks between the government and the imprisoned Kurdish leader Abdullah Ocalan.

The conflict quickly developed into a free-for-all between Mr Arinc and the president’s supporters. Ankara’s AK mayor, Melih Gokcek, came to Mr Erdogan’s defence, demanding that Mr Arinc resign. Mr Arinc in turn accused Mr Gokcek of corruption. Turkey’s prime minister, Ahmet Davutoglu, scolded both men for breaching party discipline. A public prosecutor launched probes of potential wrongdoing by both Mr Gokcek and Mr Arinc.

But the dispute goes far beyond charges of corruption, argues Soli Ozel, a political scientist at Istanbul’s Kadir Has University. Mr Arinc, he says, has “opened a Pandora’s box”. For the first time, divisions within the party have been clearly exposed. These pit Mr Erdogan, who wants to endow his presidency with executive powers, against those within the party who are rattled by the president’s increasingly erratic behaviour and want to keep his constitutional authority in check. Mr Davutoglu is said to be among the doubters.

Many have been disturbed by Mr Erdogan’s diatribes against Turkey’s central bank. In January Mr Erdogan demanded that it slash interest rates. Last month he accused the bank’s governor, Erdem Basci, of “selling out the homeland” for failing to do so. The lira has shed 11% of its value since the sniping intensified.

Mr Erdogan’s new bugbear appears to be the Kurds. Last week the president attacked the government’s dialogue with Mr Ocalan’s outlawed Kurdistan Workers’ Party (PKK) over ending its 40-year-long armed campaign for Kurdish self-rule. A 10-point plan outlining a framework for formal peace talks that was unveiled by the pro-Kurdish Democratic Peoples’ Party (HDP) “has nothing to do with democracy”, Mr Erdogan complained. A few days earlier he declared there was “no Kurdish problem”. Such comments have bred speculation that Mr Erdogan is courting Turkish nationalists, as well as his former foes in Turkey’s army, to win their backing for his executive presidency.

Some opinion polls suggest AK may not win an outright majority in parliament, let alone win the two-thirds of seats needed to change the constitution and create an executive presidency. Much will depend on how the HDP fares. Should it get the minimum 10% required for representation in parliament, it would complicate matters for Mr Erdogan. Should it fail AK will sweep all of its seats, and Mr Erdogan’s dreams may materialise.

A move to an executive presidency would only heighten many Turks’ sense of unease. The economy is slowing, and questionable arrests are undermining the rule of law. Islamic State jihadists are lapping at the country’s borders.

But a more immediate battle looms. Mr Erdogan is trying to ensure that his own allies make it onto AK’s candidate lists, but he is constitutionally barred from meddling in the AK party’s affairs. It remains unclear whether Mr Davutoglu has either the strength or the will to withstand the president and his army of business cronies and party loyalists. The HDP’s charismatic co-chair Selahattin Demirtas says his party alone can prevent “a one-man dictatorship”. He may well prove right.