Recep Tayyip Erdogan had it coming. The Turkish army was never going to remain compliant while the man who would recreate the Ottoman Empire turned his neighbours into enemies and his country into a mockery of itself. But it would be a grave mistake to assume two things: that the putting down of a military coup is a momentary matter after which the Turkish army will remain obedient to its sultan; and to regard at least 161 deaths and more than 2,839 detained in isolation from the collapse of the nation-states of the Middle East.

For the weekend’s events in Istanbul and Ankara are intimately related to the breakdown of frontiers and state-belief – the assumption that Middle East nations have permanent institutions and borders – that has inflicted such wounds across Iraq, Syria, Egypt and other countries in the Arab world. Instability is now as contagious as corruption in the region, especially among its potentates and dictators, a class of autocrat of which Erdogan has been a member ever since he changed the constitution for his own benefit and restarted his wicked conflict with the Kurds.

Erdogan: Turkey coup bid 'an act of treason'

Needless to say, Washington’s first reaction was instructive. Turks must support their “democratically elected government”. The “democracy” bit was rather hard to swallow; even more painful to recall, however, was the very same government’s reaction to the overthrow of Mohamed Morsi’s “democratically elected” government in Egypt in 2013 – when Washington very definitely did not ask Egypt’s people to support Morsi and quickly gave its support to a military coup far more bloody than the attempted putsch in Turkey. Had the Turkish army been successful, be sure Erdogan would have been treated as dismissively as the unfortunate Morsi.

But what do you expect when Western nations prefer stability to freedom and dignity? That’s why they are prepared to accept Iran’s troops and loyal Iraqi militiaman joining in the battle against Isis – as well as the poor 700 missing Sunnis who “disappeared” after the recapture of Fallujah – and that’s why the “Assad must go” routine has been quietly dropped. Now that Bashar al-Assad has outlived David Cameron’s premiership – and will almost certainly outlast Obama’s presidency – the regime in Damascus will look with wondering eyes at the events in Turkey this weekend.

The victorious powers in the First World War destroyed the Ottoman Empire – which was one of the purposes of the 1914-18 conflict after the Sublime Porte made the fatal mistake of siding with Germany – and the ruins of that empire were then chopped into bits by the Allies and handed over to brutal kings, vicious colonels and dictators galore. Erdogan and the bulk of the army which has decided to maintain him in power – for now – fit into this same matrix of broken states.

In pictures: Turkey coup attempt Show all 17 1 /17 In pictures: Turkey coup attempt In pictures: Turkey coup attempt Turkish President Erdogan attends the funeral service for victims of the thwarted coup in Istanbul at Fatih mosque on July 17, 2016 in Istanbul, Turkey Burak Kara/Getty Images In pictures: Turkey coup attempt Soldiers involved in the coup attempt surrender on Bosphorus bridge with their hands raised in Istanbul on 16 July, 2016 Gokhan Tan/Getty In pictures: Turkey coup attempt A civilian beats a soldier after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, 16 July, 2016 REUTERS/Murad Sezer In pictures: Turkey coup attempt Surrendered Turkish soldiers who were involved in the coup are beaten by a civilian Reuters In pictures: Turkey coup attempt Soliders involved in the coup attempt surrender on Bosphorus bridge Getty In pictures: Turkey coup attempt Supporters of Turkish President Recep Tayyip Erdogan wave flags as they capture a Turkish Army vehicle Getty In pictures: Turkey coup attempt People pose near a tank after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, 16 July, 2016 Reuters In pictures: Turkey coup attempt Turkish soldiers block Istanbul's Bosphorus Brigde Getty In pictures: Turkey coup attempt A Turkish military stands guard near the Taksim Square in Istanbul Reuters In pictures: Turkey coup attempt Pierre Crom/Twitter In pictures: Turkey coup attempt Turkish soldiers secure the area as supporters of Recep Tayyip Erdogan protest in Istanbul's Taksim square AP In pictures: Turkey coup attempt People demonstrate in front of the Republic Monument at the Taksim Square in Istanbul Murad Sezer/Reuters In pictures: Turkey coup attempt Turkish soldiers detain police officers during a security shutdown of the Bosphorus Bridge Reuters In pictures: Turkey coup attempt Turkish Army armoured personnel carriers in the main streets of Istanbul Getty In pictures: Turkey coup attempt Chaos reigned in Istanbul as tanks drove through the streets EPA/TOLGA BOZOGLU In pictures: Turkey coup attempt Turkish President Tayyip Erdogan speaks to media in the resort town of Marmaris Reuters In pictures: Turkey coup attempt Supporters of President Erdogan celebrate in Ankara following the suppression of the attempted coup Reuters

The warning signs were there for Erdogan – and the West – to see, if only they had recalled the experience of Pakistan. Shamelessly used by the Americans to funnel missiles, guns and cash to the “mujahedin” who were fighting the Russians, Pakistan – another “bit” chopped off an empire (the Indian one) turned into a failed state, its cities torn apart with massive bombs, its own corrupt army and intelligence service cooperating with Russia’s enemies – including the Taliban – and then infiltrated by Islamists who would eventually threaten the state itself.

When Turkey began playing the same role for the US in Syria – sending weapons to the insurgents, its corrupt intelligence service cooperating with the Islamists, fighting the state power in Syria – it, too, took the path of a failed state, its cities torn apart by massive bombs, its countryside infiltrated by the Islamists. The only difference is that Turkey also relaunched a war on its Kurds in the south-east of the country where parts of Diyabakir are now as devastated as large areas of Homs or Aleppo. Too late did Erdogan realise the cost of the role he had chosen for his country. It’s one thing to say sorry to Putin and patch up relations with Benjamin Netanyahu; but when you can no longer trust your army, there are more serious matters to concentrate on.

Two thousand or so arrests are quite a coup for Erdogan – rather larger, in fact, than the coup the army planned for him. But they must be just a few of the thousands of men in the Turkish officer corps who believe the Sultan of Istanbul is destroying his country. It’s not just a case of reckoning the degree of horror which Nato and the EU will have felt at these events. The real question will be the degree to which his (momentary) success will embolden Erdogan to undertake more trials, imprison more journalists, close down more newspapers, kill more Kurds and, for that matter, go on denying the 1915 Armenian genocide.

For outsiders, it’s sometimes difficult to understand the degree of fear and almost racist disgust with which Turkey regards any form of Kurdish militancy; America, Russia, Europe – the West in general – has so desomaticised the word “terrorist” that we fail to comprehend the extent to which Turks call the Kurds “terrorists” and see them as a danger to the very existence of the Turkish state; which is just how they saw the Armenians in the First World War. Mustafa Kemal Ataturk may have been a good old secular autocrat admired even by Adolf Hitler, but his struggle to unify Turkey was caused by the very factions which have always haunted the Turkish heartland – along with dark (and rational) suspicions about the plotting of Western powers against the state.

All in all, then, a far more dramatic series of events have taken place in Turkey this weekend than may at first appear. From the frontier of the EU, through Turkey and Syria and Iraq and large parts of Egypt’s Sinai Peninsula and on to Libya and – dare one mention this after Nice? – Tunisia, there is now a trail of anarchy and failed states. Sir Mark Sykes and François Georges-Picot began the Ottoman Empire’s dismemberment – with help from Arthur Balfour -- but it continues to this day.