Turkey on Friday threatened to abandon a key pillar of a deal with the EU to reduce the migrant flow after Greece blocked the extradition of alleged coup suspects.
Foreign Minister Mevlut Cavusoglu said Ankara was considering scrapping a "readmission agreement" under which Turkey has been taking in migrants sent back across the Aegean after landing illegally in Greece.
His remarks followed Thursday's decision by the Greek Supreme Court not to hand over eight former military officers wanted in connection with last year's failed putsch in a move which angered Ankara.
The move has put a severe strain on diplomatic ties between the two neighbours who have been working closely on both the refugee issue and to resolve the Cyprus dispute through talks in Geneva.
"We are now considering what we are going to do," Cavusoglu told state broadcaster TRT Haber a day after the ruling.
"We have a readmission agreement between us and Greece, with the European Union. We are going to take necessary steps, including the cancellation of this readmission agreement," he added.
Last March, Turkey and the EU signed a landmark agreement in which Ankara pledged to take back all illegal migrants landing in Greece to help stem migrant flows to the EU.
There is also an existing agreement between Ankara and Athens on Turkey's readmission of illegal migrants.
The March deal helped put the brakes on a massive influx of migrants and refugees, especially from Syria, Iraq and Afghanistan, which has mushroomed into a combustible political and social issue in Europe.
Turkey's pledge was aimed at deterring migrants from making the perilous sea crossing in the first place, knowing they could be sent back.
Some 1,183 migrants have been returned to Turkey in the past 12 months, Greek police figures show.
Turkey could not "look favourably on a country which protects terrorists, traitors, coup-plotters," Cavusoglu said.
"Greece needs to know this."
The Greek court's decision blocked the extradition on grounds the men would not have a fair trial in Turkey, in a move which Cavusoglu denounced as "political".
The suspects landed by helicopter in Greece a day after the botched putsch, demanding asylum. They were immediately taken into custody on grounds of entering the country illegally, but the Supreme Court ordered them released.
However they remain in police custody "for reasons of national security," Greek state agency ANA said, citing police sources. This stems from their illegal entry.
Earlier Friday, the Turkish justice ministry submitted a second extradition request to Greece for the return of the officers, state-run news agency Anadolu said.
The officers deny any part in the attempted putsch to overthrow President Recep Tayyip Erdogan and say their lives would be in danger should they return to Turkey.
Their asylum requests were initially rejected but appeals are currently being processed.
Prime Minister Alexis Tsipras' office defended the court's refusal to extradite, stressing that the Greek justice system was "solely qualified to deal with such issues and (that) its decisions are binding."
Historical foes but now NATO allies, Greece and Turkey have enjoyed warmer ties under Erdogan, though tensions never completely disappeared.
In a bid to mollify Ankara, Tsipras' office released a statement stressing that "those responsible for the coup are not welcome in our country."
But Cavusoglu said the ruling would have an "effect on relations whether we want it to or not."
Despite his remarks, European Commission spokeswoman Natasha Bertaud said she was confident that the migrant deal would remain in place.
"The EU-Turkey statement continues to be applied by both sides and we are confident that it will remain the case".
The deal has already come under strain over the delay in granting Turkish citizens visa-free travel to Europe in the Schengen zone, which Ankara sees as the EU's side of the bargain in the accord.