AS TURKEY grieves over 301 miners who died in its biggest industrial disaster, in Soma on May 13th, another truth is sinking in. Most of them perished because of appallingly unsafe conditions, lax government inspectors and an operator that put profit first. Yet Turkey’s prime minister, Recep Tayyip Erdogan, claimed that such tragedies were “in the nature” of mining—never mind that methane leaks had been reported and ignored. Mobbed by locals baying for him to resign, Mr Erdogan slapped one miner and called him an “Israeli spawn.” Photographs of one of his advisers kicking a protester as gendarmes pinned him to the ground came to stand for the government’s response.

In most democracies the disaster would have cost the jobs of ministers, or even the prime minister. Mr Erdogan’s critics gloated that his dreams of being Turkey’s first directly elected president in August were over. Unlike last year’s Gezi protests, the victims were not urban “white Turks” or minority Kurds or Alevis, but conservative Sunnis whom Mr Erdogan’s Justice and Development (AK) party has championed during 12 years of rule.

Yet Mr Erdogan is still likely to weather Soma, just as he has survived a corruption probe into his sons and his inner circle. Although he has promised a thorough investigation of Soma, few believe him. “A handful of company officials will be left to shoulder the blame, the owner, the ministers all will walk free,” predicts Huseyin Candogan, a lobbyist for architects and engineers. Eight Soma employees have been arrested, but not a single official has gone. As one Islamic activist says, “the pious masses who were enslaved by the secularists feel they are now the masters, thanks to Erdogan; they will overlook Soma as they overlooked his corruption.” And the opposition remains weak and divided.

Mr Erdogan’s propaganda machine is taking no chances. Assorted “Jews” and “co-conspirators” (followers of Fethullah Gulen, the Pennsylvania-based cleric and former AK ally) bent on overthrowing the government are to blame. Akit, a pro-AK title, screamed on its front page that the mine operator’s son-in-law was a Jew. “Sadly, the Jewish lobbies have gone after the prime minister during the Soma disaster,” tweeted Burhan Kuzu, an AK deputy. The foreign media are another target. Hasnain Kazim of Der Spiegel has had death threats and been labelled “a Jew” because he quoted a Soma resident saying “Go to hell, Erdogan.” Anti-German diatribes have grown since Germany’s president, Joachim Gauck, criticised the erosion of civil liberties on a visit in April. The Germans fret that Mr Erdogan may be inflammatory when he speaks at a rally in Cologne this weekend.

Indeed, Turkey’s Western friends are worried. “Turkey should be an important partner for the US during a period of persistent instability in a key region of the world. The increasing trend to authoritarianism of the prime minister is making this increasingly difficult,” says Eric Edelman, a former American ambassador to Turkey. Abdullah Gul, the president, was long seen as the man who might curb the prime minister’s excesses. But Mr Erdogan is said to have spurned Mr Gul’s demands to replace him as prime minister in August. Mr Erdogan wants to control candidates for the next general election, running AK from the president’s Cankaya Palace.

Mr Erdogan’s presidential ambitions seem safe thanks mainly to support from the Kurds. He is said to have promised their leader, Abdullah Ocalan, that he will be moved from an island prison and put under house arrest, among other concessions. As for economic worries, inflows of money from Ukraine and the Gulf are helping to plug the current-account deficit and Turkey’s energy bill should decline once cheap Iraqi Kurdish oil comes on stream. A strong economy remains crucial for Mr Erdogan’s popularity.

Ironically, Turkey’s secularist opposition, which loathes the Gulenists for their role in defanging the army, now sees them as the last hope. The Gulenists are believed to be behind a stream of leaked tape recordings linking Mr Erdogan to corruption. They are said to be saving “the big one” for the presidential election. But this could backfire. Gulenists in the police force and elsewhere are being purged by the thousand. Businesses accused of backing Mr Gulen, including Turkey’s biggest company, Koc Holding, face arbitrary tax inspections. One question is how many Gulenists have infiltrated the army’s ranks. “Gulenist officers drink whisky and their wives wear miniskirts and dance at balls to avoid detection,” claims a source close to Mr Erdogan. “But not for long.”

Correction: In an earlier version of this article we incorrectly said that Hasnain Kazim is an ethnic Punjabi. His family originates from Karachi in Pakistan, and he describes himself as "German with Pakistani origin". This was corrected on May 23rd 2014.