ISTANBUL (Reuters) - A Turkish court on Monday rejected a request for the release of two Greek soldiers who were detained after crossing the border into Turkey in bad weather, private broadcaster CNN Turk and other local media said.

The decision appears likely to further heighten tension with Greece. The two NATO allies, which teetered on the brink of war as recently as 1996, have seen renewed diplomatic strain over natural resources in the eastern Mediterranean and the fate of eight other soldiers who fled to Greece after a failed coup in Turkey.

Greece has said the two soldiers had been on a border patrol when they strayed from their route, calling it “the result of a mistake” because of poor weather and saying it expected their swift return.

The court decided to remand them in custody on Friday, on the grounds of attempted military espionage and entering a prohibited military zone, Turkish media said. On Monday it ruled against their lawyer, who had requested their release, CNN Turk said.

Prior to Monday’s court decision, Greece called on Turkey to comply with international law.

“Turkey is obliged to implement what is prescribed under international law...and not turn an everyday procedure into a major political, legal issue,” Greek Foreign Minister Nikos Kotzias said.

Greece said in January it would not extradite eight Turkish soldiers who fled there after a failed 2016 coup attempt against President Tayyip Erdogan. It also refused to grant them asylum and said they could be tried in Greece.

Turkey said that neither country had requested that the two Greek soldiers be swapped for the eight Turkish ones.

The two NATO partners were at the brink of war in 1974, 1987 and 1996 over long-running disputes on ethnically divided Cyprus, mineral rights in the Aegean Sea and sovereignty over uninhabited islets.

During Erdogan’s visit to Athens in December, the two countries agreed to revive a consultation process for confidence-building measures.