KASTANIES, Greece — With tear gas clouding the air, thousands of migrants trying to reach Europe clashed with riot police officers on the Greek border with Turkey on Saturday morning, signaling a new and potentially volatile phase in the migration crisis.

The scene at Kastanies, a normally quiet Greek border checkpoint into Turkey, rapidly became a tense confrontation with the potential to worsen as dozens of Greek security officers and soldiers fired canisters of tear gas. Riot police officers with batons, shields and masks confronted the migrants through the wire, yelling at them to stay back.

About 4,000 migrants of various nationalities were pressed against the Turkish side of the border. An additional 500 or so people were trapped between two border posts, but still on the Turkish side, at the long and heavily militarized land border that has turned into the flash point of the tug of war between Turkey and Europe.