Turkey has demanded the retrial of eight soldiers who fled to Greece after a failed coup last year and said it may take measures, including scrapping an agreement on refugees and migrants with Athens, after a Greek court rejected an extradition request.

Greece's Supreme Court on Thursday ruled against extraditing the soldiers, who have sought political asylum, saying they feared for their lives in Turkey. Ankara says they were involved in the July 15 coup attempt and branded them traitors.

"We demanded that the eight soldiers be tried again. This is a political decision, Greece is protecting and hosting coup plotters," Turkish Foreign Minister Mevlut Cavusoglu told state broadcaster TRT Haber on Friday.

"We are evaluating what we can do. There is a migration deal we signed, including a re-admission deal with Greece, and we are evaluating what we can do, including the cancellation of the re-admission deal with Greece," Cavusoglu added.

Subsequently, a European Union spokeswoman said it was confident its cooperation with Turkey on migration will continue to hold firm.

Relations between Greece and Turkey, neighbours and NATO allies, have improved over the years but they remain at odds over territorial disputes and ethnically split Cyprus. In 1996, they almost reached the brink of war over an uninhabited islet.

The two countries play an important role in the handling of Europe's worst migration crisis in decades and the EU depends on Ankara to enforce a deal to stem mass refugees and migrants fleeing to Europe.

The suspects - who landed a helicopter in Greece a day after a botched putsch in Turkey and asked for asylum - were also ordered to be released from police custody.

READ MORE: Greek court blocks extradition of Turkey coup suspects

Earlier on Friday, the Turkish justice ministry submitted a second extradition request to Greece for the return of the officers, state-run news agency Anadolu said.

Cavusoglu said the ruling would have an "effect on relations whether we want it to or not".

The controversy also comes as Greece and Turkey are trying to work together to find a deal for the reunification of Cyprus in ongoing talks brokered by the United Nations.

The officers deny having taken part in the attempted failed coup attempt and have claimed their lives are in danger should they return to Turkey.

They have requested asylum in Greece but their applications were originally rejected in July.

However, their appeals are currently being processed.