The "deep state" burst up from the depths in Turkey this week, threatening not only Prime Minister Recep Tayyip Erdogan's hold on power but the country's hard-won reputation as a modern society. The idea that, behind the facade of apparently normal institutions, shadowy forces are at work, contesting one another and undermining the proper process of government, is part of politics in many places. But this is especially so in Turkey where, since Ottoman times, conspiracies and secret or semi-secret networks, real or imagined, have played an important role.

The Turks themselves coined the phrase that describes this politics that lies beneath. The deep state can be the government itself, disposing of its opponents by illicit or unfair means, packing ministries with its placemen, interfering in military promotions or using criminal investigations to tarnish its critics, to give just a few examples. It can also be used to describe the government's critics and enemies as they try to infiltrate key institutions, such as schools and universities, state industries or military staffs, or to smear ministers and exploit or manufacture scandals.

The deep state originally meant the military, police and intelligence networks which assigned themselves the task of defending the secular Kemalist regime against both Islamists and leftists and often used clandestine means to do so. That particular deep state was literally on trial in Turkey until April this year, when harsh verdicts were handed down on military officers, journalists and others accused of being members of the Ergenekon movement.

Opinions differ as to whether the Ergenekon plot really existed, at least in the fully fledged form claimed by the government. If it did, then the military deep state was dealt a damaging and perhaps terminal blow. If it did not, then the government's own deep state exploited its control of the judiciary and the police to achieve a sharp reduction in the army's once prominent political position in Turkey.

But no sooner had one deep state been disposed of than another hove into view, in the shape of the Hizmet movement, previously a close if covert ally of Mr Erdogan's Justice and Development, or AKP, party. The origins of the falling-out of the former friends are not clear. But the quarrel came into the open when the government moved, earlier this year, to close down private schools on the grounds that they gave the well-off unfair advantage. Hizmet, which runs a quarter of these establishments, took the proposed law, though since softened, as a declaration of war. In swift succession came moves and countermoves that revealed Hizmet and the AKP at each other's throats. First, the police, which is supposedly infiltrated by Hizmet, pursued a corruption investigation to the point of arresting the relatives of some cabinet ministers and businessmen close to the government. Then the government replaced a number of senior police officers. Then came the resignation of three cabinet ministers, one of them alleging as he went that Mr Erdogan himself should step down, followed by a reshuffle of half the cabinet. The best guess is that there really is something to investigate and that it may involve the prime minister or his relatives themselves, but that it is a vengeful Hizmet which has helped push the affair into the open.

This is a sorry tale. Hizmet, which has relatively moderate Islamist views, also has some of the characteristics of a cult or of an Islamic Opus Dei. The AKP, as the handling of the Gezi Park demonstrations in the summer showed, is less democratic and more underhand than it claims to be. That these two forces should be fighting over the body politic in this way should force re-examination, both inside and outside the country, not just of the truth about the deep state or states in Turkey, but of the true condition of Turkish democracy.