ISTANBUL (Reuters) - A Turkish penal court has released a journalist detained for more than a year over alleged ties to a failed military coup in 2016, the private news agency Dogan reported.

Sahin Alpay, a journalist in the now defunct Zaman daily, was ordered to be released late on Friday under judicial control and confinement to his house while his trial continues.

“I am glad to be reunited with my family again but I cannot say I am free,” Dogan quoted Alpay as saying as he left Silivri jail, west of Istanbul, after 20 months in detention.

“There are thousands I am leaving behind who have nothing to do with terrorism or the coup attempt. I believe Turkey will not be free if they are not free.”

Turkish authorities have detained 50,000 people suspected of links to the failed coup in July 2016, which the government blames on supporters of U.S.-based cleric Fethullah Gulen. Gulen has denied any link to the coup attempt.

Turkey’s Constitutional Court had ruled earlier on Friday for a second time that Alpay’s rights had been violated while in custody and had requested his release.

Alpay was accused of links to terrorist groups and attempting to overthrow the government in the coup attempt that killed more than 240 people. He denies the charges.

Authorities have shut about 130 media outlets since the failed coup. The Turkish Journalists’ Association says about 160 journalists are in jail, most held since the putsch.

In January, Turkish penal courts decided to keep Alpay and another journalist in detention hours after the constitutional court had requested they be released.