In September 1980 the Turkish military mounted a coup, arrested half a million people, sentenced more than 500 of them to death, and executed 50. The military left power two years later, having imposed a constitution that further entrenched its prerogatives.

For decades, the generals’ veto power in Ankara formed the legal spine of what Turks call derin devlet, or deep state—the self-appointed defenders of the national interest, nobody above them, nothing beneath them. As a descriptor for Turkish reality this had a lot going...