In March 2007, the current affairs weekly Nokta published a series of articles investigating the Turkish military's activities against the ruling AKP government. On 29 March, Nokta published excerpts of a diary, alleged to have been written by Admiral Ozden Ornek, the former navy commander, and inadvertently left on his laptop. The diary entries contained detailed plans – prepared jointly by the commanders of the army (Aytac Yalman), navy (Ornek himself), the air force (Ibrahim Firtina) and the gendarmerie (Sener Eruygur) – for a military coup in 2004. According to the diary, it was only the opposition of the Chief of Staff at the time, Hilmi Ozkok, which prevented the coup plans from being put into action. The code name for the coup was "Blond Girl". As the diaries suggest, another coup, code named "Moonlight", was being prepared by general Eruygur. Another Nokta article on 5 April 2007 was based on a leaked report prepared by the Office of the Chief of General Staff, which classified press outlets and journalists as pro- or anti-military. The military did not deny the veracity of the report, although internal investigations were undertaken to uncover who was responsible for leaking the 'blacklist.'
In a speech to the War Academy in Istanbul on 13 April 2007, then Turkish president Ahmet Necdet Sezer, whose 7-year mandate was to end on 16 May, accused the AKP of trying to undermine the secular order.
"The political regime of Turkey has not faced such danger since the founding of the republic… The activities aimed against the secular order and efforts to bring religion into politics are raising social tensions."
On 24 April 2007, the AKP announced that Abdullah Gul would be its presidential candidate. Gul had been Prime Minister in 2002 and then Deputy Prime Minister and Foreign Minister, and a strong champion of Turkey's EU integration effort. His nomination met with a harsh reaction from the military, president Sezer, and Kemalist politicians, many of them drawing attention to the fact that his wife wore the headscarf.
On 27 April, the Turkish military issued a dire warning by way of a late-night posting on its website. The general staff declared its opposition to Gul's nomination, reminding the Turkish government of the military's role as a "staunch defender of secularism." It warned that it would display its "position and attitudes when it becomes necessary."
Mass demonstrations against Gul followed in several cities. The organiser of the Ankara demonstrations was Sener Eruygur, president of the Ataturk Thought Association, retired general and former head of the gendarmerie (and one of the four generals who, according to Nokta, planned a coup in 2004).
The muscle flexing failed, however. The AKP opted for early elections, which took place on 22 July 2007, and scored a landslide victory with almost 47 percent of the vote – an increase of 12.38% on their 2002 result. Abdullah Gul was duly elected president by Parliament shortly thereafter. The general election was widely interpreted as a showdown between the military establishment, with its traditionally unchallengeable authority, and the will of the Turkish people. Omer Erzeren commented on qantara on 30 July 2007:
"The election results are a slap in the face for the military and opposition parties, who thought they could score with nationalist slogans and militaristic poses."
It looked as if Turkish democracy had successfully passed this test, and could now look forward to five years of stable government.
Then, on 17 January 2008, Abdurrahman Yalcinkaya, Chief Public Prosecutor of the Supreme Court of Appeals, warned the ruling Justice and Development Party (AKP), that its attempt "to lift the headscarf ban" would have serious consequences. The AKP had prepared to amend the Turkish constitution in a way that would enshrine freedom of dress at universities.
A few days later, on 3 February 2008, retired General Dogu Silahcioglu, writing in Cumhuriyet, advocated closing down the AKP:
"Regardless of statements made, political Islam has taken over the Republic of Turkey. There is only one option left in the fight against political Islam. That is the elimination of the AKP government…"
On 14 March 2008, Yalcinkaya applied to the Turkish Constitutional Court to close down the AKP. The indictment, which also recommended banning 71 politicians, including Prime Minister Recep Tayyip Erdogan and President Abdullah Gul, from politics, was unanimously accepted by the Constitutional Court on 31 March 2008.
The 162-page indictment accused the AKP of being "a focal point for anti-secular activities" and of acting against the constitution, which mandates – in Article 2 – that Turkey is a secular state. As the indictment's introduction reads:
"The AKP is founded by a group that drew lessons from the closure of earlier Islamic parties and uses democracy to reach its goal, which is installing Shariah in Turkey."
Picture taken from Radikal, 31 July 2008
On 30 July 2008, the president of the Supreme Court, Hasim Kilic, announced the verdict: the AKP would not be closed down as demanded by the State Prosecutor. It was a close decision, however. Six out of the 11 judges voted to ban the AKP – only one vote short of the majority needed to close a political party. In a second verdict, 10 judges voted to reduce the AKP's public financial support by 50 percent for the coming year. The Chief Justice was the only judge to plead in favour of rejecting all the charges against the AKP.