A Turkish court has overturned a decision to release the head of the local branch of Amnesty International from detention, the human rights group said, calling the ruling "a travesty of justice of spectacular proportions".

A court in Istanbul approved the state's request on Thursday to keep Taner Kilic, head of Amnesty International Turkey, in pre-trial detention.

The decision came after a Turkish prosecutor filed an appeal contesting an earlier court decision on Wednesday that ordered Kilic's release.

"Over the last 24 hours we have borne witness to a travesty of justice of spectacular proportions," said Salil Shetty, secretary-general of Amnesty International, in a statement.

Kilic was arrested in June last year and accused of having ties to the Gulen movement, a group Turkey says was responsible for a failed coup attempt in July 2016.

Both Kilic and Amnesty International have denied the allegations.

"To have been granted release only to have the door to freedom so callously slammed in his face is devastating for Taner, his family and all who stand for justice in Turkey," Shetty said.

Kilic was transferred from a prison in Izmir, where he has been held since his arrest, to the custody of Turkey's gendarmerie, Amnesty said.

His next court hearing is scheduled for June 21.

Andrew Gardner, Amnesty's senior adviser and researcher on Turkey, said the decision was "devastating" for Kilic's family.

The Istanbul trial court has now overturned its own release verdict it made yesterday. Taner will stay in pre-trial detention. What (or who) made them do it? This is devastating for Taner’s family and a disgrace to justice. — Andrew Gardner (@andrewegardner) February 1, 2018

Earlier this week, Hurriyet Daily News reported that Kilic's father, the former head of Turkey's Constitutional Court, said he was "deeply saddened" by the allegations against his son, which he dismissed as baseless.

"It is also interesting that similar allegations have been circulating since I retired from office. All this aims at defaming myself and my family," Hasim Kilic said.

Turkey has detained thousands of people who it alleges have ties to Fethullah Gulen, a Turkish Muslim scholar who lives in self-imposed exile in the United States. Tens of thousands of public servants have also been fired from their jobs.

The government says the arrests and dismissals are aimed at removing Gulen supporters from state institutions.

Human rights groups have roundly condemned the state's post-coup purge.