* Hundreds jailed for plotting to overthrow government
* Courts releasing dozens of suspects after law change
* PM Erdogan now battling Muslim cleric, not military
* Case exposes weakness of Turkish justice system
By Gareth Jones
ISTANBUL, March 12 (Reuters) - Prime Minister Tayyip Erdogan welcomed the jailing of army officers, academics and journalists on coup plot charges last year as a key moment in his drive to tame Turkey's army. Now as the case unravels, his camp suggests some should never have been put behind bars.
The slow collapse of the "Ergenekon" case has exposed the judiciary - central to efforts to anchor democracy in Turkey - as a system in disarray, caught in a new power struggle between Erdogan and an Islamist cleric. That raises questions for foreign investors and the EU, which Ankara seeks to join.
Turks have reacted with a mixture of relief, horror and disbelief over the past week as courts ordered the release of dozens of men jailed over a number of years for plotting a military coup against Erdogan's Islamist-rooted government.
The men include former armed forces chief retired General Ilker Basbug and other high-ranking military officers, prominent journalists, ultra-nationalist lawyers and even the convicted killers of Christian missionaries and an Ankara judge.
"Our opinion and political position towards coup plotters has not changed," one of Erdogan's top advisers, Yalcin Akdogan, told Reuters recently.
"But there are certain claims, that people have been jailed on forged evidence, some irrelevant crimes have been made up and innocent people have been imprisoned. These must surely be evaluated and innocent people should not be charged."
The Ergenekon defendants were all caught up in a trial targeting nationalist, secularist opponents of Turkey's ruling AK Party that was strongly backed at first by Erdogan as well as by his then-ally Fethullah Gulen, an influential preacher.
U.S.-based Gulen is widely believed to have helped Erdogan jail the Ergenekon defendants via his network of supporters in the judiciary and police. But then the two men fell out. Erdogan has now vowed to eradicate 'Gulenists' he accuses of using the same network to engineer a corruption scandal to topple him.
Hundreds of members of the police and judiciary have been purged.
"The releases (of the Ergenekon suspects) are a product of the power struggle between Gulen and Erdogan," said Gareth Jenkins, an Istanbul-based author and veteran Turkey observer.
"This power struggle has not so much destroyed the rule of law in Turkey but demonstrated very clearly that it does not exist," he said, adding that the original convictions were full of "absurdities" and had been driven by a "marriage of convenience" between Erdogan and the Gulenists.
Erdogan has now hailed the release after 26 months of Basbug, whose conviction he had at the time supported, and tried to pin blame for the Ergenekon trial solely on the Gulenists.
"It is all very Orwellian ... Erdogan is using Ergenekon as an instrument to undermine the Gulenists and I think they are panicking. You see it in the barrage of leaked voice recordings, it smacks of overkill, of desperation," said Jenkins.
Jenkins was referring to the almost daily release on YouTube of alleged voice recordings of conversations involving Erdogan, his son Bilal, businessmen and AKP lawmakers, purportedly exposing graft in Erdogan's inner circle. The postings are all anonymous and Reuters has been unable to verify them.
In an article in the Financial Times, Gulen - who rejects claims he is behind the postings and also denies any political agenda - accused Erdogan of riding roughshod over Turkey's institutions and endangering the political and economic reforms the government has made over the past decade.
Erdogan, who remains Turkey's most popular politician and whose AK Party is expected to far outstrip its rivals in local elections on March 30, also blames Gulen for the investigation into government corruption launched last December.
That inquiry has effectively been frozen after the government transferred thousands of police officers and tightened its grip on the courts, prompting criticism from the European Union, though membership talks are stalled.
After a European Parliament debate on latest developments in Turkey, EU enlargement chief Stefan Fule tweeted this week: "(The debate) in the EP showed Turkey is losing its supporters. Reflection ... in Ankara needed to reverse this trend."
Surveying the disarray in the courts, erratic and seemingly arbitrary convictions, new curbs on the Internet, the campaign against the Gulenists and deepening political polarisation, some see a tragedy of Greek proportions unfolding, with Erdogan as the flawed hero.
"We are seeing a classic case of hubris, of fatal over-confidence," said one liberal academic who once backed Erdogan but grew disillusioned. Alarmed by what he sees as a clampdown on free expression, he asked not to be named.
In his 11 years at the helm, Erdogan has proven Turkey's most energetic leader since Mustafa Kemal Ataturk, founder of the modern republic: driving economic reforms, empowering pious, entrepreneurially-minded Turks who form his power base and taming an army - NATO's second largest - that had toppled four democratic governments in the latter half of the 20th century.
"LIKE PUTIN'S RUSSIA"
"From 2001 to about 2006-7 we were in a period of ever-extending democracy, rights and freedoms. We got used to this, especially younger people, but now we see only efforts to restrict and curtail," said the liberal academic.
Political analyst Atilla Yesilada of Global Source Partners agreed that the omens were not good for politics or the economy.
"Turkey risks becoming like (Vladimir) Putin's Russia. Capital flight is already pervasive ... And foreign investment clearly needs transparency, an even playing field. Nobody could claim Turkey has that today," he said.
"Erdogan lives in a black-and-white world, so logically anybody not allied with the AK Party in this struggle (with the Gulenists) will be classified as hostile and also eradicated."
The release of the Ergenekon suspects became possible due to a new law that scraps the special courts that convicted them and cuts to five years the maximum period that anyone can spend in jail while awaiting trial or being tried. The law was widely seen as a bid to purge Gulenists from the judiciary.
But its indiscriminate and haphazard implementation has rattled many Turks, especially more liberally-minded people who back eventual EU membership and members of religious and ethnic minorities, such as Christians and Kurds, who have long feared the workings of a "deep state" in Turkey outside democratic control.
Among those released are five young men convicted of torturing and then slitting the throats of three Christians at a publishing house in the southeast city of Malatya in 2007.
Other men to walk free include defendants in the trial over the murder of Turkish-Armenian journalist Hrant Dink and an ultra-nationalist lawyer best known for his efforts to bring charges against Nobel laureate novelist Orhan Pamuk and other writers for insulting "Turkishness". (Additional reporting by Nick Tattersall, editing by Ralph Boulton and Mark Trevelyan)