THE aftermath of the attempted coup in Turkey on July 15th has been fertile ground for conspiracy theories. Pro-government newspapers have alleged that CIA agents directed the coup from an island in the Sea of Marmara; that a retired American general wired billions of dollars to rogue Turkish soldiers; and that the United States directed Turkish forces to kill Turkey’s President, Recep Tayyip Erdogan. An Islamist daily called Germany an enemy state, and pictured its chancellor, Angela Merkel, in a Nazi uniform.

The surge in anti-Western sentiment is widely shared. One poll found that 84% of Turks believe that the coup-plotters received help from abroad; more than 70% suspect America of having a hand. Mr Erdogan and his ministers have accused the West of double standards, and warn of a serious deterioration in ties unless the United States extradites Fethullah Gulen, the Pennsylvania-based Islamist cleric whom they blame for orchestrating the coup. A senior American official complains that using Mr Gulen as the only yardstick for bilateral ties puts the relationship at risk. Mr Erdogan does not seem to care.

In part, Western governments have themselves to blame. With the exception of America and Germany, many were slow to condemn the coup attempt, fuelling suspicions that they were waiting to see how it would play out. In response to the purge of government institutions that followed, Austria’s chancellor urged the European Union to suspend membership talks with Turkey. Germany’s top court banned Mr Erdogan from addressing a rally in Cologne by video link. To date, no EU head of state has travelled to Turkey to express solidarity with the victims. A visit to Ankara by America’s vice-president, Joe Biden, due on August 24th, is seen as too little, too late. “The United States should have shown stronger political support earlier,” says Unal Cevikoz, a former Turkish ambassador to Britain.

Turkish politicians, including those opposed to the ruling Justice and Development (AK) party, accuse the West of being more critical of the government’s response to the coup than of the carnage that accompanied the putsch. Some Western diplomats acknowledge a failure to come to grips with the scale of the violence, which left some 270 dead, and with widespread support for the purges. “There is no understanding in Europe that things would have been much worse if the coup had succeeded,” says one. “For the Turks, this was a test of loyalty, and Europe failed it.”

Yet Europe is right to fear that the crackdown on suspected Gulen sympathisers has spun out of control. Over 80,000 people have been arrested, sacked or suspended, including soldiers, judges, teachers, policemen, businessmen and even football officials. Nearly 100 journalists have been detained and more than a hundred media outlets shut down; ordinary criminals have been set free to make room for political cases. Many of those purged appear to have only tenuous links to the Gulenists. But concerns about repression fall on deaf ears, writes Sinan Ulgen, a former Turkish diplomat. The West, he says, “has eroded its ability to gain influence in Turkey at a time when this leverage is possibly more important than ever”.

Popular resentment against the West and the Gulenists has accomplished what Mr Erdogan had failed to in recent years: rally a large majority of Turks to his side. Since late June, the president’s approval rating has jumped from 47% to a record 68%. A mass gathering addressed by Mr Erdogan earlier this month attracted over a million people, as well as the leaders of two of the three biggest opposition parties. The main pro-Kurdish party was left out.

In Mr Erdogan’s view, only one outside power has adequately backed his government: Russia. Before meeting Vladimir Putin in St Petersburg on August 9th, the Turkish leader praised him for wasting no time in offering his support. Unlike Western officials, Mr Erdogan pointedly remarked, “Putin did not criticise me on the number of people from the military or civil service who had been dismissed”.

Such plaudits, along with Mr Erdogan’s show of contrition for Turkey’s downing of a Russian jet last November, are music to Mr Putin’s ears. Yet much as the Russian leader might want to exploit the rift between Turkey and the West, his dalliance with Mr Erdogan has its limits. Mr Putin might offer Turkey some support against the Gulenists in Central Asia, where the movement runs a network of schools, says Soner Cagaptay of the Washington Institute, a think-tank. But the two countries will remain divided over the crucial issue of Syria, where they are still backing opposite sides in the country’s civil war.

For now, says a Western diplomat, NATO need not fear that Turkey will stray far from the alliance. But, he continues, Mr Putin will continue to pit Turkey against America and the EU: “He can play that game better than anyone else.” For a decade, Turkey’s once pro-European government has been drifting away from the West. After the ambivalent American and European responses to the coup, that drift is accelerating.