By Daren Butler
ISTANBUL (Reuters) - They once bestrode Turkey the masters of all they surveyed. Governments were swept aside, a prime minister dispatched to the gallows. Even in quiet times, from their staff headquarters opposite parliament, they commanded obedience.
Now around 20 percent of serving generals are in prison accused of plots against Prime Minister Tayyip Erdogan, imaginatively codenamed Sledgehammer, Ergenekon, Blonde Girl, Moonlight.
So sudden has been this reversal the generals appear robbed of their voice. Erdogan has for now succeeded in his aim of taming the "Pashas", officers, who disdain his Islamist roots. But as coup trials stutter over technical appeals, his position ranging over a demoralized military has its perils.
Turkey's military guards the front line in the West's campaign against Syrian President Bashar al-Assad and may yet be called upon to fight. Last Friday saw a Turkish warplane shot down by Syrian air defenses. Public sympathy may grow as fears of a war spread. An officer in jail is one less in the barracks
"We spend our time writing letters and books," said one senior officer held at a military prison in the Hadimkoy neighborhood of Istanbul.
"To explain how the future of our country has been darkened, putting the screams of our souls down on paper," he added in comments relayed to Reuters through his lawyer.
The resort to literature finds an ironic echo in the past.
Bulent Ecevit, a prime minister arrested and interned by the generals in a 1980 army coup, wrote poetry during his captivity, his verse mostly an avowal of love to his wife, Rahsan.
Erdogan himself fell foul of the military in the years before his election and served a jail term for publicly reciting a verse declaring "The mosques are our barracks, the domes our helmets, the minarets our bayonets" - words considered by a court to be incitement to religious militancy.
Now the Pashas take their turn in court. Even the 94-year-old leader of the 1980 putsch, general Kenan Evren, is on trial over hangings, torture and disappearances.
"I never really thought that one day I would see this," wrote Mehmet Ali Birand, author of books on Turkey's military.
The main military prison at Hasdal in Istanbul is now so overcrowded that many serving officers were transferred to the smaller Hadimkoy, while retired officers are held at Silivri jail outside the city, where the biggest trials are being held.
Sitting beside a computer with a screensaver set to an image of secular state founder Mustafa Kemal Ataturk, a former top commander described the army as the victim of a campaign to rob it of popular respect.
"These steps were designed to render the armed forces ineffective and make them an untrustworthy institution in the eyes of the people," the old soldier said at his Istanbul office.
An annual European Union survey showed Turks trust in the military slid from 90 percent in 2004 to 70 percent in 2010.
Once Erdogan's Justice and Development Party (AKP) swept to power in 2002 it became locked in a struggle with a military that saw itself as custodian to the secular vision of Ataturk, the soldier-statesman who founded the republic in 1923 after the collapse of the Ottoman Empire.
The scales tipped decisively in the AKP's favor in 2007, when the party faced down generals who tried to stop parliament electing Abdullah Gul as president on the grounds that he was a former Islamist and his wife wore an Islamic headscarf.
A low point for the military came in January, when prosecutors hauled in retired General Ilker Basbug, chief of staff between 2008 to 2010, and accused him of being one of Ergenekon's leaders.
Basbug, regarded as one of the most cerebral chiefs the army has had, described the charges as "tragi-comic" before being sent to join old comrades at Silivri prison.
Parliament is also scrutinizing the activities of the army pension fund OYAK.
CALLING OFF THE LAWYERS?
Last July, the top brass appeared to throw in the towel, when the chief of staff quit along with three other retiring generals to protest the detention of comrades and interference in the annual promotion round.
The resignations allowed Erdogan to install a chief of staff of his choice, General Necdet Ozel, and relations between the government and the military have since improved.
"Ozel is displaying behavior that suggests he is more in line with the government and is more keen to meet the government's wishes," said retired Major General Armagan Kuloglu, now an analyst at a think-tank in Ankara.
Perhaps mindful of the problem Ozel faces stamping authority over a military shell-shocked by mass arrests, Erdogan recently criticized special prosecutors for ordering too many detentions.
Critics had hitherto seen the prosecutors as "attack dogs" for Erdogan's government as it strove to bring the army to heel and convince the electorate that the AKP was its best bet to break Turkey's cycle of coups.
His AK Party is now working on plans to dissolve the courts - a measure that could result in a collapse of the cases and undermine Erdogan's credibility.
"The more likely scenario if it falls apart is that gradually the imprisoned officers would be released on bail and the cases would continue," Istanbul-based security analyst Gareth Jenkins said. "It would just be allowed to peter out but they would be released from prison."
Erdogan may calculate, though, that the job is done.
Opposition parties are weak, the military has been subordinated by political reforms and cowed by the courts, while most judges who were on the side of the generals have been replaced in the past two years.
With his opponents scattered, Erdogan may have decided now is the time to muzzle prosecutors, and give General Ozel a chance to rebuild morale.
A month after Ozel's appointment AKP Deputy Chairman Huseyin Celik outlined a 15-point plan that envisaged changes in military-civilian relations as part of Turkey's democratization.
Moves to abolish a military law article seen as justifying military intervention in politics are already underway and the general staff may be subordinated to the defense ministry.
The shortening of military service, creation of a professional army, changes in army education and changes in the military command structure are also among planned changes.
Celebrations for national holidays have lost some of their militaristic trappings, and dress rules at military social engagements have been relaxed so, for example, the wives of President Gul or Prime Minister Erdogan are no longer unwelcome because they wear Muslim headscarves.
For all the bad press the officer corps has received, the special place the army holds in the national consciousness cannot be underestimated in a country where nationalism is a common denominator among political parties including the AKP.
Turkish forces haven't fought in any war since the early 1950s in Korea, but the people's emotional attachment to the armed forces is reinforced regularly with funerals for soldiers killed in the long-running separatist conflict with the militant Kurdistan Workers Party (PKK).
On several nights each year, city streets are filled with the sights and sounds of noisy send-offs given to young Turkish men going for compulsory military service.
"They cheer, shots are fired into the air, they shout 'our soldier is the greatest soldier', flags are flown. You will not see this in any other country," said Major General Kuloglu.
"The Turkish public really does love its armed forces."
Yet, given the republic's coup-laden history, some people find the accusations against the military far from incredible.
Generals carried out three coups against democratically elected governments between 1960 and 1980, and they forced the first Islamist prime minister to quit in 1997.
Selma Yigit, a 52-year-old Istanbul housewife, believes the "pashas", as the generals are known, never lost arrogance.
"I can't find a reason not to believe that the army was planning a coup. They staged four coups before, didn't they? And those times were terrible, I know because I was there. So, what is so surprising about it if they were planning again?"
Most Turks, however, doubt whether the generals would dare overthrow another democratically elected government.
Many suspect cases have been cooked up, with public opinion shaped by leaks to newspapers like Taraf and Zaman, closely tied to the Islamic movement headed by Fethullah Gulen.
"Too much of the evidence is doubtful to believe the investigations are aimed at further democratization," said Hasan Yurdakul, .
Folding his liberal newspaper as he sat at a city centre cafe, Hasan Yurdakul, a 34-year-old lawyer, voiced commonly held suspicion that prosecutors were hounding certain groups and individuals for political gain.
"The aggressive way in which these investigations are carried out makes you wonder about the existence of a secret agenda or at least a hidden motive behind these operations against the army, intellectuals, academics, journalists."
The military's forays into the political arena have become increasingly rare. General Ozel has made none.
For all his frustration with special prosecutors' hounding his officers, Basbug said repeatedly that the time of coups was over, and many, if not most, Turks believed him.
The case against him revolves around websites set by the military to spread black propaganda against the AKP, depicting the party as a threat to Turkey's secular order.
Erdogan denies the AKP has any hidden Islamist agenda.
While the websites were established during a predecessor's tenure, some remained open several months into Basbug's command. Based on this, prosecutors began building a case that he was a leader of the mysterious Ergenekon network.
Since the Ergenekon investigation began five years ago, hundreds of people, including academics, journalists and social activists have been placed under lengthy pre-trial detention.
Defendants in another case, Sledgehammer, have said they despair of receiving a fair hearing at the special authority court. The case revolves around a war game seminar in 2003 that prosecutors say was part of an elaborate conspiracy to undermine confidence in Erdogan's government.
A total 364 officers, serving and retired are being tried in connection with the plot, which allegedly included plans to bomb historic mosques in Istanbul and trigger conflict with Greece, in order to clear the path for a military takeover.
Defense lawyers have boycotted closing stages of the trial because of judges' refusal to hear testimony from some expert witnesses. With the case deadlocked, the judge has now referred it back to the prosecutor's office, raising the possibility of a retrial.
Could the military 'strike back' over its humbling?
"I don't think there is any way the military can turn the clock back...and I don't think at the moment they would really want to," Jenkins said. "These cases have had a devastating impact on their morale and I think their focus if these cases are dropped will be trying to restore the morale of the officer corps rather than seeking to take revenge."
(Additional reporting by Jonathon Burch and Ece Toksabay; Writing by Daren Butler and Simon Cameron-Moore; Editing by Ralph Boulton and Janet McBride)