SINCE the 1960s, whenever Turkey’s meddlesome generals have seized power, Turks have accused America of being responsible. After the botched coup attempt on July 15th by a cabal of mid-ranking generals and junior officers, the old reflex appeared again. Turkey’s labour minister, Suleyman Soylu, declared that America was behind the attempt to overthrow the country’s Islamist president, Recep Tayyip Erdogan. (He vaguely cited the “activities” of unnamed American magazines as proof.) Pro-government media outlets teemed with conspiracy theories. In a column in Yeni Safak, a daily newspaper, Aydin Unal, an MP from Mr Erdogan’s Justice and Development party (AK), suggested that American army officers took part in the fighting. In previous decades such rants could be shrugged off. But this time they are part of an increasingly severe diplomatic crisis.

The reaction from John Kerry, America’s secretary of state, was uncharacteristically stiff. In a phone call to his Turkish opposite number, Mevlut Cavusoglu, on July 16th Mr Kerry said insinuations that America had played any role in the coup were “utterly false and harmful to our bilateral relations”. Speaking to an American news channel the following day, Mr Kerry warned Mr Erdogan against using the coup as an excuse to clamp down on his opponents. A wide-ranging purge, Mr Kerry said, “would be a great challenge to his relationship to Europe, to NATO and to all of us”.

AK is not heeding his advice. More than 7,000 people have been detained and thousands of judges and other bureaucrats purged. At least 11 online news portals associated with the opposition have been shut down. But the biggest source of friction is the presence in America of Fethullah Gulen, a cleric who leads a secretive Muslim sect, and whom the Turkish government accuses of masterminding the failed putsch.

Since 1999 Mr Gulen has been living in self-imposed exile in rural Pennsylvania. For years, Mr Erdogan has accused the imam, a former ally in his battle to declaw the army, of seeking to topple his government. The Turks demand that America hand him over. Yet Turkey has not formally requested Mr Gulen’s extradition; the file, over 1,000 pages long, has yet to be fully translated into English. Western diplomats reckon it will be padded with outlandish, conspiratorial claims, and that federal prosecutors will throw it out. Mr Erdogan would probably ramp up his anti-American rhetoric in response. Turkey’s prime minister, Binali Yildirim, has already warned that requiring “evidence” before booting out Mr Gulen would call America’s friendship with Turkey into doubt.

That would be nothing new. Relations with America have seesawed ever since 1952, when Turkey became NATO’s first mainly Muslim member. Back then, Turkey was prized as an ally against the Soviet Union. Today it is seen as a buffer between Europe and the Middle East, with its homicidal jihadists and millions of Syrian refugees. And continued access to Turkey’s Incirlik air-base is vital to the American-led war effort against Islamic State (IS). Some Western officials worry that Turkey will seal off the base if America refuses to hand over Mr Gulen.

Turkey’s relations with America were already strained by America’s support for the Syrian Kurdish militia groups known as the People’s Protection Units (YPG). The YPG are widely seen as the most effective force fighting IS in Syria, but they are closely linked to the Kurdistan Workers’ Party (PKK), an outlawed guerrilla movement that has been fighting the Turkish state for decades in the name of Kurdish autonomy, and has carried out numerous terrorist attacks. Turkey views the YPG as terrorists too, and has repeatedly asked America to ditch them, only to be snubbed each time.

From the American perspective, Turkey has never been fully committed to the war against Islamist groups in Syria. For years, the Americans have pressed Turkey to do more to stop jihadist fighters slipping in and out of Syria to join up with (or carry out missions for) IS and other Islamist groups. It is in Turkey’s own interest to do so. IS has carried out several big terror attacks inside Turkey, including the suicide-bombing in June of Istanbul’s Ataturk airport. Few doubt it will strike again.

Ash Carter, America’s defence secretary, makes no secret of his distaste for Turkey’s president. Calls to replace Incirlik with a base elsewhere in the region are growing louder in America’s Congress. Meanwhile, Mr Gulen may threaten Turkish stability, but nothing like as seriously as the jihadists both inside and outside the country. Turkey needs friendship with America more than ever. Instead, in a paroxysm of post-coup paranoia, Mr Erdogan is putting the entire alliance at risk.