Greek police fired teargas towards migrants gathered on its border with Turkey on Saturday, as a crisis over Syria shifted onto the European Union's doorstep.
Greece, which has tense relations with its neighbor Turkey at the best of times and was a primary gateway for hundreds of thousands of asylum seekers in 2015 and 2016, reiterated it would keep migrants out.
"The government will do whatever it takes to protect its borders," government spokesman Stelios Petsas told reporters.
Ankara said on Thursday it will no longer contain hundreds of thousands of asylum seekers after an air strike on war-ravaged Idlib in Syria killed 33 Turkish soldiers.
Almost immediately, convoys of people appeared heading towards the Greek land and sea borders.
"This has nothing to do with Idlib," Petsas said, adding that in the past 24 hours Greek authorities had prevented attempts by 4,000 people to cross the border.
Greece's Skai TV aired live video from the Turkish side of the northern land border at Kastanies showing Greek riot police firing teargas rounds at groups of migrants who were hurling stones and shouting obscenities.
A Reuters witness said there were about 500 people in the buffer zone between the two border posts, and beyond that on the Turkish side hundreds more.
Overnight, demonstrators hurled flaming pieces of wood at police, amateur footage filmed by a police official on the scene, which was seen by Reuters, showed.
An estimated 3,000 people had gathered on the Turkish side of the border at Kastanies, a Greek government official said. Kastanies is just over 900 km (550 miles) north-east of Athens.
Turkish President Tayyip Erdogan said on Saturday that some 18,000 migrants had crossed borders from Turkey into Europe. Speaking in Istanbul, he did not immediately provide evidence for the number, but said it would rise.
Greek police were keeping media about a kilometer away from the Kastanies border crossing, but the broader area, where the two countries are divided by a river, was more permeable.
A group of Afghans with young children waded across fast-moving waters of the Evros river and took refuge in a small chapel. They crossed into Greece on Friday morning.
"Today is good" said Shir Agha, 30 in broken English. "Before, Erdogan people, police problem," he said. Their shoes were caked in mud. It had rained heavily the night before, and by early morning, temperatures were close to freezing.
Greece had already said on Thursday it would tighten border controls to prevent coronavirus reaching its Aegean islands, where thousands of migrants are living in poor conditions.
Nearly a million refugees and migrants crossed from Turkey to Greece's islands in 2015, setting off a crisis over immigration in Europe, but that route all but closed after the European Union and Ankara agreed to stop the flow in March 2016.