Turkey's top court has ruled that the rights of ex-military chief Ilker Basbug were violated, paving the way for his possible release from jail.
Basbug was sentenced to life in prison last year for plotting to overthrow the government.
He was found guilty of leading a shadowy network of hard-line nationalists known as Ergenekon.
The ruling could set a precedent for more than 200 others jailed for their alleged roles in the Ergenekon affair.
The constitutional court ruled in favour of Basbug's appeal, saying a lower court had failed to publish its detailed verdict on the case and send it to the appeals court, Reuters news agency reports.
This had violated a constitutional clause concerning personal freedom, it said.
The judgement means his lawyer is expected to file for his release.
The Ergenekon trials, which went on for five years, targeted the military establishment, long seen as the guardian of Turkey's secular values.
Basbug, who led the military between 2008 and 2010, has been in jail since his arrest in January 2012.
The retired general denied the charges of setting up and leading a terrorist organisation in order to topple the government led by Prime Minister Recep Tayyip Erdogan's Islamist Justice and Development Party.