* Hundreds of people were convicted in Ergenekon trial
* Courts start to free defendants after legal changes
* Erdogan now battling Islamic cleric, not military
By Ece Toksabay and Gareth Jones
ISTANBUL, March 10 (Reuters) - Turkey ordered the release of five men convicted of plotting a coup, days after an ex-military chief was freed in a case that has come to highlight a power struggle between Prime Minister Tayyip Erdogan and a U.S.-based Islamic cleric.
The five - a journalist, two lawyers, a retired colonel and a convicted gang leader - were among hundreds convicted in the "Ergenekon" case, which played a central role in Erdogan's drive to break the political power of Turkey's military.
Cleric Fethullah Gulen is widely believed to have helped Erdogan by using a network of supporters in the judicary and police to drive the Ergenekon trial forward. But the two men have since fallen out and the government now suggests the defendants may have been unjustly treated.
In emotional comments on his release after six years jail, journalist Tuncay Ozkan said: "Turkey is today in a very dramatic situation, resembling a country on the edge of a cliff. We cannot leave it in the hands of thieves and murderers."
Retired General Ilker Basbug, the former chief of Turkey's armed forces, spoke with similar bitterness about his incarceration on his release last Friday.
Murat Yetkin, columnist for Hurriyet daily, saw the release as symptomatic of a new political atmosphere in the country stirred by conflict between Erdogan and Gulen
"This new atmosphere seems like it will have further effects on political life as Turkey heads for critical local elections on March 30," he wrote.
Erdogan's feud with Gulen now poses one of the biggest challenges to his 11-year rule after a series of audio recordings anonymously posted on the Internet purportedly revealing corruption and other malpractices in the government.
Erdogan has placed the blame for the wiretaps on Gulen and his followers, whom he accuses of building a "parallel state" - an ironic echo of Turkey's "deep state" comprising staunchly secular, nationalist army officers and security personnel at the centre of the Ergenekon allegations.
Gulen denies involvement in the wiretaps.
Erdogan says the recordings are "fabricated" and part of a plot to sully his ruling Islamist-rooted AK Party and to undermine his government ahead of the local elections and a presidential poll scheduled for August 10.
The government's response, transferring thousands of police officers and seeking to tighten its grip on the courts, has brought sharp criticism from the European Union, which Turkey has been seeking to join for decades, and rattled investors, helping send the lira to record lows.
In Monday's Ergenekon ruling, the Istanbul court said the five men should be released because parliament recently cut the maximum detention period before conviction to five years. They have already spent a longer period of time in detention.
The reduction in detention limits was part of legislation abolishing special courts used to try those involved in conspiracy plots such as Ergenekon.
Among others the Istanbul court ordered to be freed on Monday was lawyer Alparslan Arslan, jailed for life after killing a judge and wounding four others in an attack in 2006. He had also been charged with involvement in the Ergenekon plot.
The other lawyer freed was Kemal Kerincsiz, an ultra-nationalist best known for his efforts to bring charges against Nobel laureate novelist Orhan Pamuk and other writers for insulting "Turkishness".
The abolition of the special courts, driven by Erdogan's desire to purge Turkey's judiciary of Gulen sympathisers, has also led to the release of prisoners involved in other cases.
A defendant in the trial over the murder of Turkish-Armenian journalist Hrant Dink was freed last Thursday. At the weekend another court released five defendants held over the killing of three Christians, whose throats were slit in a publishing house in the southeastern city of Malatya in 2007.
Their release has sparked anxiety among members of Turkey's small Christian minority.
"Releasing some (defendants) ... may be justified since holding people in detention for five years is, of course, unjustified," said Yavuz Baydar, a columnist at the English-language daily Today's Zaman.
"But the core matter is that after Erdogan's desperate gamble for survival, by abusing the outdated judicial system's weaknesses ... we now enter a very delicate phase ... with, possibly, gruesome consequences."
(Additional reporting by Daren Butler Writing by Gareth Jones; editing by Ralph Boulton)