A Turkish court on Monday ordered the release under supervision of two prominent journalists jailed over alleged links to the failed 2016 coup in the country.

Ahmet Altan and Nazli Ilicak walked out of prison on Monday evening where they had been serving a sentence of 10 and a half years and eight years and nine months respectively, for "helping a terrorist group", state news agency Anadolu reported.

They were ordered freed for time already served -- around three years each. Both were also ordered not to leave the country.

Turkish journalist and writer Ahmet Altan walks with his daughter Sanem Altan after being released from prison
Turkish journalist and writer Ahmet Altan walks with his daughter Sanem Altan after being released from prison AFP / BULENT KILIC

They were accused of ties to the outlawed group of US-based Muslim preacher Fethullah Gulen, whom Ankara accuses of ordering the failed coup targeting President Recep Tayyip Erdogan.

Altan and Ilicak, both respected intellectuals in Turkey, were sentenced to life in prison in 2018, but the top criminal appeals court overturned the ruling in July this year.

The Court of Cassation said they should not have been tried over the attempted coup, but instead for the charge of "helping a terrorist group", which carries a shorter prison sentence.

Turkish journalist Nazli Ilicak waves after being released from Bakırkoy women's Prison in Istanbul.
Turkish journalist Nazli Ilicak waves after being released from Bakırkoy women's Prison in Istanbul. AFP / Yasin AKGUL

Erdogan accuses former ally-turned-foe Gulen of having ordered the attempted coup and lists his movement as a "terrorist" organisation. Gulen has strongly denied any involvement in the failed coup bid.

Altan, 69, is a novelist and journalist who founded the opposition Taraf newspaper, which has since shut down.

His brother, journalist Mehmet Altan, was acquitted by the court on Monday after being released last year.

Turkish journalist and writer Ahmet Altan (C) said, "From the beginning, there was no proof".
Turkish journalist and writer Ahmet Altan (C) said, "From the beginning, there was no proof". AFP / BULENT KILIC

Ilicak, 74, is a former MP who wrote for leading newspapers including Hurriyet.

Ahmed Altan and Ilicak have denied any involvement in the failed coup, calling such accusations "grotesque".

They were accused of sending "subliminal messages" that an overthrow of the government was imminent during a televised panel hosted by Ilicak.

Upon his release, surrounded by family members and jubilant supporters, Altan told reporters that "since the beginning, there was nothing. There was no proof. How could such a crime be possible and why would I commit such a thing?".

Earlier during the court hearing Altan had cut a defiant figure, according to Turkish media, saying: "If you want to keep me in jail, do so for as long as you want. I'm not afraid."

"I prefer to spend the rest of my life in prison than to give in to fear," he reportedly added.

Both Altan and Ilicak were arrested during a mass crackdown on journalists that followed the 2016 coup bid.

Altan wrote a book about his time in prison called "I Will Never See the World Again".

Turkey ranked 157 out of 180 countries in the 2019 World Press Freedom index published by Reporters Without Borders.