* Hundreds of people were convicted in Ergenekon trial
* Courts start to free defendants after legal changes
* Erdogan now battling Islamic cleric, not military (Updates with more releases)
By Ece Toksabay and Gareth Jones
ISTANBUL, March 10 (Reuters) - Turkey ordered the release of 19 men convicted of plotting a coup, days after an ex-military chief was freed in a case now entwined in a power struggle between Prime Minister Tayyip Erdogan and a U.S.-based Muslim cleric.
The 19 people, including prominent journalists, lawyers, retired military officers, a convicted gang leader and the killer of a top court judge, were among hundreds convicted in the "Ergenekon" case, which lay at the heart of 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.
The latest releases underscore how radically the Erdogan-Gulen feud has altered Turkey's political landscape.
In emotional comments on emerging from almost six years in 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 when he was released on Friday.
Murat Yetkin, columnist for Hurriyet daily, saw the release as symptomatic of a new political climate 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 quarrel 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 before the local elections and a presidential poll scheduled for Aug. 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 convicts 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".
Among those released later in the day was Dogu Perincek, a leftist politician heading Turkey's Worker's Party. He was handed an aggravated life sentence in August as part of the Ergenekon trials.
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 and Humeyra Pamuk; Writing by Gareth Jones; Editing by Ralph Boulton and Alistair Lyon)
Our Standards: The Thomson Reuters Trust Principles.