After the former general Mustapha Kemal “Ataturk” established the Turkish Republic, the Army became the guardian of his secular and modernizing vision of Turkey’s future. On four occasions since 1960 the Army has overthrown civilian governments that diverged from its vision of Turkey’s proper course.
Recip Tayyip Erdogan forged an alliance between his own Islamist Justice and Development Party (AKP) and Fethullah Gulen, an imam with a wide network of supporters in the bureaucracy, business, and media. In 2002 Erdogan led the AKP to power in free elections. The position of the Army with regard to a religious party worried Erdogan. Those worries increased in advance of the 2007 elections when the Army publically affirmed its role as guarantor of Turkey’s secular identity and that Islamism was incompatible with that identity.
In 2010 prosecutors charged 236 senior serving or retired Army officers with planning a coup against the government. Government prosecutors based their case largely on computer files regarding “Operation Sledgehammer,” an alleged army plot dating back to 2003 to overthrow the Erdogan government. They won convictions after the court refused to allow the defendants to introduce evidence that the computer files were fraudulent. Most of the defendants got long prison terms.
By 2012 Erdogan had begun to fall out with Gulen. Erdogan and the AKP had worn out their welcome with many Turks. Having been in power for over a decade, they had lost their strict sense of right and wrong. Critics accused the government of corrupt alliances with business interests under the guise of modernizing Turkey. In Summer 2013, massive demonstrations took place in Istanbul over plans to convert a public park into a shopping mall. In December 2013 prosecutors—apparently part of Gulen’s network of supporters–charged several government ministers with graft. Erdogan lashed out at Gulen’s “parallel state,” which he accused of plotting its own coup. Thousands of members of the police and judiciary were summarily removed as Erdogan sought to purge the administration. Erdogan now found himself in an awkward position. He had allied with the Gulen network to tame the Army, but now he had fallen out with the Gulen network.
To make matters worse, in Summer 2014, ISIS suddenly exploded as a regional danger in neighboring Iraq and Syria. Like Al Shabab in Somalia, the Houthis rebels in Yeman, and Boko Haram in Nigeria, ISIS is made up of irregular fighters who cannot stand up to a real army backed by an effective government. ISIS posed no danger to Turkey so long as the Army would fight and the government could act. Aye, there’s the rub. Would the Army back Erdogan against both the Gulen network and ISIS, or would it devise its own solution?
In 2014 the convictions were over-turned by the constitutional court, which ordered a re-trial. In Spring 2015, the government appointed a new prosecutor to handle the case. In March 2015, Erdogan announced to a gathering of senior Army officers that “starting with myself, the whole country was misled, tricked. We were subjected to a conspiracy, a coup attempt, to seize control of Turkey.” The prosecutor asked the court to dismiss the charges because he was shocked, shocked to discover that there was gambling going on. No, wait, he discovered that the computer files on which the conviction had been based were fraudulent.
 Emre Peker, “Turkish Court Acquits Officers in Coup Plot,” WSJ, 1 April 2015 (although I believe the report to be true).
 For example, documents dated in 2003 could be shown to have been produced using Microsoft Word 2007.
 The latter might involve shooting Erdogan and tossing his body on a garbage heap.