A Turkish court has ordered the immediate release of ex-military chief Ilker Basbug, who was sentenced to life imprisonment last year for plotting to overthrow the government, his lawyer said.
The decision on Friday came a day after Turkey's top constitutional court ruled that Basbug's legal rights had been violated.
Ilkay Sezer, Basbug's lawyer, said that the verdict was significant, adding that Basbug "will walk free three hours later".
Basbug was sentenced to life in prison in 2013, along with hundreds of military officers who were given long terms for their role in the so-called "Ergenekon" conspiracy, an alleged plot to overthrow the government.
The military, which sees itself as the guarantor of Turkey's secular principles, has carried out three coups - in 1960, 1971 and 1980 - and pressured an Islamist government to step down in 1997.
The Turkish prime minister, Recep Tayyip Erdogan, who has previously tried to curb the military's influence in Turkey, has recently sought to get the army back on his side as he fights for political survival in a bitter feud with his ally-turned-opponent Fethullah Gulen, whom he accuses of masterminding a fraud scandal to topple him.
In a conciliatory gesture towards the army that further increases the chances of retrials for the hundreds of convicted officers, the parliament in February abolished the specially appointed courts that tried them.
The constitutional court's ruling could set a precedent for more than 200 others jailed for their alleged roles in coup-plotting.
"I hope the decision will set a precedent and other victims - some suffering from grave health problems - will be released immediately," lawyer Sezer said earlier on Friday.
The mass coup trial, seen as a key test in Erdogan's showdown with secularist and military opponents, polarised the country, with critics denouncing it as a witch hunt to stifle dissenting voices.
The government now appears keen to blame Gulen for the trials against the military. An advisor to the prime minister recently suggested that Gulen supporters masterminded the trials.
The influential Gulen movement was a key backer of Erdogan's Justice and Development Party (AKP) when it first came to power in 2002.
But the alliance shattered after police raids in December, in which dozens of Erdogan's key business and political allies were detained on corruption allegations.
Erdogan has accused followers of Gulen in the police and the judiciary of concocting the investigation to unseat his government in a crucial election year.
Gulen has lived in the eastern US state of Pennsylvania since he left Turkey in 1999 to escape prosecution on charges of "anti-secular activities".
Basbug was a staunch defender of the military in its showdown with the government, calling the trials a "black stain" on the country's history.
Source: Al Jazeera and agencies