A lot remains unclear regarding the attempted coup that shook Turkey. But it is possible to draw some preliminary conclusions about its background and implications.

The coup was not planned and implemented within the chain of command. The Chief of General Staff and the heads of the crucial First Army and Special Forces remained loyal to the government. This, not people on the street, was the key reason the coup failed. Not least, it allowed President Erdogan to slip out of Marmaris before being caught and to get to Istanbul.

The coup appears to have been hastily put together and poorly implemented. The failure to seize or liquidate the president, cabinet, and vital communication infrastructure made it possible for Erdogan to regain the initiative. This suggests that the plotters’ hands were forced, and that the coup was launched prematurely. There are suggestions that a list was leaked before the coup of officers scheduled for discharge and arrest, which could have precipitated the coup, explaining the lack of proper preparation.

The most vexing question concerns the exact identity of the coup plotters. Who were the architects behind what appears on the surface to be a faceless, even leaderless coup? The Turkish government is pointing fingers at the Fethullah Gülen movement – something that may seem counter-intuitive, because it was precisely Erodgan’s confrontation with them two years ago that led him to let the military back in from the cold and rebuild for himself a ruling coalition much more right-wing nationalist in nature, united by the struggle against the Kurds.

But that said, it has long been assumed that Gülenist cliques were present in the military at mid-career ranks. But no one believes that Gülenist officers had risen to the ranks of three or four star generals. Thus, while it is very likely that Gülenist officers were involved, it is equally obvious that they could not have carried this out on their own. The more senior generals apparently involved do not seem to have any Gülenist affiliations.

Hence, the coup may have been carried out by an unholy alliance between a faction of old-school Kemalist and Gülenist officers. If this is the case, it would mean that while Erdogan allied with the top military brass against the Gülenists, another military fraction allied with the Gülenists against Erdogan.

This is what Turkey has come to: its politics in the past few years can best be understood as a struggle for power between two Islamic sects. In the process, Turkey’s military appears now to have at least three separate fractions and to be much more politicized and divided than has been assumed.

A further important aspect of the coup was President Erdogan’s response: he mobilised his supporters through the use of Islamic rhetoric that would have been unthinkable even five years ago. Mosques were ordered by the State religious directorate, which Erdogan has built up into a behemoth, to broadcast calls for prayer all through the night and to call regime supporters out on the streets. Often, the call appears to have been framed as “Jihad”.

And indeed, those who came out to oppose the coup almost exclusively looked like Islamist activists singing Islamist chants. It is already apparent that President Erdogan has concluded that Islamist mobilisation was what saved him, hence the remaining inhibitions against further Islamisation of Turkey will dissipate. Erdogan’s Turkey is likely to more openly deploy Islamist rhetoric and policies.

The Gülen fraternity’s alleged responsibility for the coup is already being used as pretext for a full-scale purge of state institutions. Unlike previous occasions, the coup gives Erdogan the opportunity to arrest and jail opponents by the thousands. It is already clear that repression will spread beyond Gülenists: entire lists of scholars, journalists and officials to be jailed have already been leaked. Whatever is left of Turkish democracy is about to be neutralised, and if Erdogan completes this repressive purge, it goes without saying that Turkey can no longer be called a democracy.

The failed coup will have important foreign policy implications. Erdogan and his entourage have long believed the Gülen fraternity to be following Washington’s orders, and senior government officials have already suggested that the U.S. was behind the coup. Erdogan appears to be making extradition of Gülen a litmus test of the U.S.-Turkish alliance, a demand that will likely not be granted, given the lack of any kind of concrete evidence. In fact, the involvement of Gülenist officers does not necessary implicate the ailing preacher himself in the coup.

In any case, the U.S.-Turkish relationships has been put at risk, and Secretary John Kerry’s threat of consequences for Turkey’s NATO membership has shown that perhaps Washington is tiring of Erdogan’s antics. The most likely immediate point of contention will be the Incirlik military base, which the U.S. uses to hit ISIS targets in Syria.

Similarly, Turkey-EU relations will be impacted, most immediately because it is hard to imagine how the EU will now go ahead with visa liberalisation. In turn, that likely puts the cynical migration deal between Brussels and Ankara to death. If Turkey reinstates the death penalty, which is quite plausible, Turkish-EU relations are likely to deteriorate even further.

In conclusion, it is important to see the coup attempt as an indication of the deeper decay of the Turkish state under Erdogan’s rule. As Erdogan has sought to concentrate power in his own hands, the exercise of power has become increasingly informal, all checks and balances removed, and all institutions including his own political party increasingly ineffectual. This made the coup possible in the first place, and future coups can be avoided only if Turkey develops strong, accountable democratic institutions.

But instead, under Erdogan’s personal rule, Turkey’s destabilisation is likely to continue. Thus, European leaders now need to see what has been obvious for some time: rather than an ally with which to handle regional problems, Turkey will itself increasingly be the problem.