EARLIER this year, Melih Gokcek, the veteran mayor of Ankara and a member of the ruling Justice and Development (AK) party, hosted a group of foreign journalists at an estate on the capital’s outskirts. Mr Gokcek began by clicking his way through a gruesome PowerPoint presentation on the previous summer’s failed coup, mixing images of bodies mangled by tanks with the soundtrack from the film “Requiem for a Dream”. He finished by claiming that Western powers had been involved in the bloodbath, that the Obama administration had created Islamic State, and that American and Israeli seismic vessels were deliberately setting off earthquakes near Turkey’s Aegean coast. A bewildered reporter asked where Mr Gokcek was getting his information. “I have the world’s best intelligence service at my disposal,” the mayor responded. “It’s called Google.” He did not seem to be joking.

Mr Gokcek’s career as Turkey’s leading conspiracy theorist, a title fought over by many members of President Recep Tayyip Erdogan’s inner circle, came to an abrupt end on October 23rd, when the mayor announced he would resign after more than two decades in the job. (Many were baffled that he had held on to his office for so long.) His decision followed weeks of rising pressure by Mr Erdogan and pro-government newspapers, some of which suggested Mr Gokcek would face criminal charges if he refused to step down. The nature of those charges was not specified, but many readers got the hint. In 2015 a former deputy prime minister accused Mr Gokcek of large-scale corruption. He never produced the evidence he claimed to have gathered, and the mayor denied the allegations.

Mr Gokcek’s is one of many heads to have rolled at municipalities across Turkey this autumn. Since September, six AK mayors whose terms would have expired in 2019 have stepped down. Mr Erdogan is said to have ordered the resignations, which began with the mayor of Istanbul.

The fact that Mr Erdogan can casually defenestrate elected officials is further evidence of how authoritarian his government has become. Over the past year he has presided over the arrests of more than 80 mayors in the Kurdish south-east. Many have been replaced by government-appointed trustees. Inside AK itself, dissent has ceased to exist. There is less and less room for it elsewhere. The purges unleashed by Mr Erdogan since the coup have cost some 60,000 people their freedom and 150,000 their jobs. In a sign that more arrests may be coming, police detained Osman Kavala, a respected philanthropist, on October 18th, and Saban Kardas, a think-tank scholar, a couple of days later.

The repression at home is causing headaches abroad. In early October, after police in Istanbul arrested a Turkish staffer at the American consulate on terrorism charges, the United States suspended visa services across Turkey. Mr Erdogan’s government responded that it would no longer issue visas to Americans. The clash between the two NATO allies is not abating. “They are seething here,” says Henri Barkey, a former State Department official, referring to his old workplace. (Mr Barkey has been unable to set foot in Turkey for the past year. Turkish authorities are investigating him and several other Americans, including a former CIA chief and a New York senator, for supposed links to the coup.)

The mood in the European Union is equally foul. At a summit this month, EU leaders discussed freezing the aid Turkey gets as part of its bid to accede to the bloc. On October 25th the European Parliament voted to cut it by up to €80m ($94m), citing the human-rights situation. The membership talks have reached a dead end.

The general in his labyrinth

Under emergency rule, which was recently prolonged for three months, Mr Erdogan enjoys unchecked powers. But by turning the purge against his own party’s mayors he may have revealed a sense of anxiety about his future. Earlier this year a referendum on giving him more power barely passed despite the government’s efforts to stack the odds in his favour; in Ankara and Istanbul, the “no” vote prevailed.

Senior AK officials defend the sackings by saying that the party must rejuvenate itself for the local, parliamentary and presidential elections in 2019. Polls show the number of “undecided” voters rising. “We need some changes and new faces,” says Yasin Aktay, a presidential adviser. But there is no guarantee that the mayoral shake-up will play in Mr Erdogan’s favour. “He thinks AK voters are disappointed with the local administrations,” says Atilla Yesilada, a political analyst. “They may be disappointed with him.”