A Greek court has refused an extradition request from Turkey for eight soldiers accused of being involved in a failed coup attempt last July.

Greek Supreme Court judge Giorgos Sakkas ruled on Thursday (26 January) that the servicemen would not receive a fair trial in their homeland and must stay in Greece.

The Turkish government had demanded that the officers be handed over and reacted with anger, sparking fears of a diplomatic crisis. Authorities stated that Greece had failed in the "fight against terrorism" with its decision and the ruling was "politically motivated".

The eight men fled Turkey in a helicopter on 16 July, just hours after the failed coup attempt and claimed political asylum upon arrival in Greece.

Prime Minister Recep Tayyip Erdoğan later blamed the revolt on US-based Islamic cleric Fethullah Gulen.

The soldiers, believed to be three majors, three captains and two sergeant-majors, deny involvement in the coup inside Turkey's capital Ankara, and reject having links to a planned assassination attempt against Erdoğan.

They were expected to stand trial in Turkey but successfully argued their lives would be in danger.

Eight turkish soldiers
The eight Turkish soldiers, who fled to Greece in a helicopter and requested political asylum after a failed military coup against the government, are escorted by police officers as they arrive at the Supreme Court in Athens on 26 January 2017 REUTERS/Alkis Konstantinidis

"The possibility of their rights being violated or reduced regardless of the degree of guilt or the gravity of the crimes they are accused of does not allow the implementation of extradition rules," a Supreme Court president said according to Reuters.

A purge of the military and civil service began in the days following the botched coup.

Turkey's foreign ministry said in a statement: "We protest this decision which prevents these individuals who have threatened the life of our president and took an active role in a coup attempt that killed 248 of our citizens... from appearing in front of Turkish judiciary."

The state-run Anadolu news agency reported that Turkish authorities had issued arrest warrants for the soldiers and that Turkey would "use all avenues of law" to ensure the soldiers' extradition and prosecution.

Turkey coup attempt
Turkish military stand in front of the Republic Monument at the Taksim Square in Istanbul, Turkey on 16 July 2016 Murad Sezer/Reuters

Before the verdict, Greek Justice Minister Stavros Kontonis said he would respect the decision while the soldiers' lawyer, Christos Mylonopoulos, said the verdict was "a big victory for European values".

The men said that their relatives in their home country have lost jobs and had their passports confiscated. It is understood that they will remain in protective custody pending final decisions on their asylum applications.

An ongoing purge since the coup attempt has seen tens of thousands of people arrested, including lawyers, teachers, clerics and journalists.