LONDON • Turkish President Recep Tayyip Erdogan has reasserted control over the country after a military coup against his regime fizzled out.
"Turkey has a democratically elected government and president," he told jubilant supporters after returning to Istanbul, the country's biggest city, yesterday. "We are in charge and we will continue exercising our powers," he vowed.
But the failed coup which killed at least 160 people will leave deep wounds in Turkey's political life, polarising a nation already battered by chronic regional instability and mounting economic problems.
Mr Erdogan, who has ruled Turkey since 2003, first as prime minister and now as president, has always had a testy relationship with his military.
Turkey's armed forces, one of Europe's most powerful, see themselves as guardians of the country's secular tradition and initially viewed with suspicion Mr Erdogan's Justice and Development Party (AKP), a centre-right movement devoted to restoring Islam to what it sees as its rightful place in Turkish public life.
Turkey's top officers also have a long record of staging coups: no fewer than four have taken place over the past half a century.
But alone among Turkey's modern politicians, Mr Erdogan appeared able to tame the military - through a mixture of shrewd politics and good economic management.
The country's stellar performance - its economy grew by an average of 6 per cent yearly for over a decade - consolidated Mr Erdogan's popularity. The ruling AKP also used constitutional reforms to downgrade the military's influence over decision-making and arrested many generals for allegedly plotting against the government.
And Mr Erdogan enhanced the powers of the police over the military; the rivalry between the two served the government well, and was crucial in ensuring the coup's failure over the weekend.
The motives for the latest coup remain obscure. The President and his ministers blame Fethullah Gulen, a Muslim scholar and former imam who helped Mr Erdogan's rise to power but has since fallen out with the government and lives in exile in the United States, for "masterminding" the plot.
But no evidence was produced. A simpler and, for the moment, more likely explanation is that the plotters resented the military's loss of traditional privileges and blamed Mr Erdogan for the deterioration in domestic security, where a spike in terrorist attacks and in fighting against Kurdish separatists has claimed the lives of 600 members of the security forces plus 5,000 civilians since last year alone.
The coup flopped because it did not involve the top military command; apart from six generals, most of the general staff was apparently not consulted. The plotters also failed to present a convincing political platform, or attract any of the opposition parties.
They also didn't seem to have an alternative government to install, or a coherent media strategy to engage with the public. In short, theirs was a classic example of how a coup should not be mounted.
The result was a fiasco resembling the attempted coup in Spain in February 1981, or the Soviet one in August 1991. Like those previous bids, the Turkish plot to seize power crumbled when confronted with large crowds of demonstrators who could be neither mowed down nor controlled.
Turkey's constitutional structures therefore survive unscathed, and the bombing of the Parliament building will probably go down as the Turkish military's last attempt to intervene in politics.
Still, Turkey's immediate political future is hardly encouraging. Mr Erdogan remains a deeply polarising figure, opposed by many of the country's intellectuals and the business community, who accuse him of authoritarian tendencies and of shutting down newspapers which criticise him.
He is almost certain to respond to the coup by accelerating his quest to change the Constitution in order to give himself supreme powers, despite evidence that at least half the electorate is against such a move.
Mr Erdogan will also order a further purge of the military. And although he got the diplomatic support he expected from the United States and Turkey's allies in the Nato military alliance, relations between Turkey and other Western nations are likely to remain tense.
Mr Erdogan has already demanded that the US extradite Fethullah Gulen to face Turkish justice, something the American authorities won't contemplate. Meanwhile, some Turkish Cabinet members are claiming that the US itself may have been involved in the plot, always a tempting explanation in a country where conspiracy theories are rife.
And European Union nations, now dependent on Turkey to reduce the flow of migrants to the continent, will be increasingly divided about how much support they should give to a Turkish leader who certainly has a democratic mandate, but who now appears determined to impose a one-man rule.
Turkey has had a narrow escape from disaster over the weekend. But only at the price of storing up even bigger challenges in the future.