REYHANLI, Turkey (AP) — The presidents of Turkey and Russia spoke by phone Friday to try to defuse tensions that rose significantly in Syria after 33 Turkish troops were killed in a Syrian government airstrike, and a new wave of refugees and migrants headed for the Greek border by land and sea after Turkey said it would no longer hold them back.

The attack Thursday marked the deadliest day for the Turkish military since Ankara first entered the Syrian conflict in 2016 and also was the most serious escalation between Turkish and Russian-backed Syrian forces, raising the prospect of an all-out war with millions of Syrian civilians trapped in the middle.

NATO envoys held emergency talks at the request of Turkey, a NATO member. Turkey’s 28 allies also expressed their condolences over the deaths and urged de-escalation, but no additional NATO support was offered.

Apart from providing some aerial surveillance over Syria, NATO plays no direct role in the conflict, but its members are deeply divided over Turkey’s actions there, and European allies are concerned about any new wave of refugees.

Turkish President Recep Tayyip Erdogan, whose country already hosts more than 3.5 million Syrian refugees, has long threatened to “open the gates” for millions to flee to Europe unless more international support was provided.

Greece and Bulgaria increased security at their borders with Turkey in preparation for an influx.

The crisis stems from a Syrian government offensive that began Dec. 1 with Russian military support to retake Idlib province in northwestern Syria, the last opposition-held stronghold in Syria. Turkey, the main backer of the Syrian opposition, has lost 54 soldiers this month, including the latest fatalities, and now feels the need to respond strongly.

Thursday’s attack sharply raised the risk of direct military confrontation between Turkey and Russia, although Turkish officials blamed Syria for the airstrike. The Turkish stock market fell 10%, while the Turkish lira slid against the dollar.

In their phone call, Erdogan and Russian President Vladimir Putin discussed implementing agreements in Idlib, the Kremlin said. Fahrettin Altun, Erdogan’s director of communications, said they had agreed to meet “as soon as possible.”

Two Russian frigates armed with cruise missiles were en route to the Syrian coast, Russian navy officials said. The Admiral Makarov and the Admiral Grigorovich of the Black Sea Fleet both previously took part in Russia’s offensive in Syria.

Erdogan held a six-hour emergency security meeting in Ankara late Thursday, the Anadolu news agency reported. Turkish Foreign Minister Mevult Cavusoglu spoke to NATO Secretary General Jens Stoltenberg by telephone while Erdogan’s spokesman Ibrahim Kalin, who plays a senior role in foreign affairs, spoke to U.S. National Security Adviser Robert O’Brien.

Russia’s Defense Ministry said the Turkish troops that came under fire were deployed among “terrorist battle formations.” They were in the area of Behun, and according to coordinates given to Russia’s Reconciliation Center in Syria, “there were no Turkish military units in the area … and there weren’t supposed to be,” the ministry said,

Russian air forces did not carry out airstrikes in the area, the statement added, and after receiving information about Turkish casualties, “the Russian side took all the necessary measures in order for the Syrian forces to stop the fire.”

In recent weeks, Turkey has sent thousands of troops as well as tanks and other equipment to Idlib. As recently as Wednesday, Erdogan gave the Syrian government until the end of February to pull back from its recent advances or face Turkish “intervention.”

The offensive already has triggered the largest single wave of displacement in Syria’s nine-year war, sending nearly 950,000 people fleeing to areas near the Turkish border for safety. Ankara, the Syrian rebels’ last supporter, sealed its borders in 2015 and under a 2016 deal with the European Union agreed to step up efforts to halt the flow of refugees.

Turkish Foreign Ministry spokesman Hami Aksoy warned that the movement of migrants to the West could continue if the situation in Idlib deteriorated further.

“Some asylum seekers and migrants in our country, worried about developments, have begun to move towards our western borders,” he said. “If the situation worsens, this risk will continue to increase.” However, he added that there was “no change” in Turkey’s migration policy.

Greek Prime Minister Kyriakos Mitsotakis tweeted that no illegal border crossings will be tolerated, and that Greece was not to blame for the “tragic events in Syria.”

Already on Friday, some people took minibuses and taxis from Istanbul and headed toward Greece. Dozens waited on the Turkish side of the border gate at Pazarkule; a few hundred were waiting in a fenced-off no-man’s land between the two countries.

Off Turkey’s west coast, several rubber dinghies with groups of people aboard were seen heading for the island of Lesbos after apparently setting off from Ayvacik in broad daylight, but Greece’s coast guard said there was no notable increase in migrant arrivals by Friday afternoon. Five boats carrying a total of 151 people had arrived — a fairly average daily number — and the coast guard said there were no reports that Turkish officials were allowing migrant boats to sail unchecked.

Greece has about 50 coast guard patrol boats active in the eastern Aegean, assisted by about a dozen vessels from Frontex, the European border agency.

Dozens gathered on the Turkish side of the frontier in Greece’s northeastern Evros region, shouting “open the borders,” a Greek police official said, speaking on condition of anonymity because as they were not authorized to speak to the press on the record.. Police and military border patrols were deployed on the Greek side to prevent anyone trying to cross without authorization.

At one point, Greek police said they used tear gas and flash grenades to move the crowds back after an estimated 450 people massed at the Turkish side of the Kastanies border. The crossing was closed temporarily.

Omer Celik, spokesman for Erdogan’s ruling party, said Turkey was “no longer able to hold refugees” following the Syrian attack, reiterating a standing threat by Ankara.

Bulgaria said it was deploying “army units, national guard and border police staff” on its border with Turkey to counter “a real threat” of an influx, Prime Minister Boyko Borissov said after a Cabinet meeting.

Fighting in Idlib continued Friday..

The Syrian Observatory for Human Rights, a war monitoring group, said after the attack on Turkish troops, Turkey’s armed forces shelled Syrian army positions, killing at least 16 soldiers. It gave no further details and there was no comment from Syria’s state media.

Turkey provides some of the militants with direct support and has accused Syria of breaking a 2018 agreement to reduce the conflict in Idlib. Russia and Syrian President Bashar Assad have said Turkey has failed to honor a deal to separate extremist groups from other fighters in the region.

The Turkish-backed Syrian opposition fighters retook a strategic northwestern town from government forces, cutting a key highway just days after the government reopened it for the first time since 2012.

Despite losing the town of Saraqeb, Assad’s forces made major gains to the south. Assad now controls almost the entire southern part of Idlib province after capturing more than 20 villages Thursday, state media and opposition activists said.

Wilks reported from Ankara, Turkey. Associated Press writers Daria Litvinova in Moscow; Albert Aji in Damascus, Syria; Bassem Mroue in Beirut, Costas Kantouris in Thessaloniki, Greece, and Veselin Toshkov in Sofia, Bulgaria, contributed.