The Army overthrows the country's government when the government (elected) leaders go too far off the secular path. Then it's simply a matter of new elections.
This Asian Times news item from a couple or three years ago 'splains a little for those who do not know.
Another contentious item for the armed forces and the AKP is the purge of Islamists from the military. The military is not happy that the purged Islamists are sometimes given government jobs.
The AKP has direct connections to that 1997 Islamist effort.
IN most places a military coup is a catastrophe. Only Turkey is so f’d up that it’s an improvement.