IDOMENI, Greece — Greek riot police struggled to maintain order Thursday after chaotic clashes between asylum-seekers at the country’s border with Macedonia, where thousands seeking a new life in the European Union have seen their long trek north brought to an abrupt halt by closed borders and new rules in a policy of selective admission.

At least two people were injured Thursday at the border as hundreds of people rejected by Macedonia – so-called economic migrants – clashed with the Syrians, Afghans and Iraqis that Macedonia is allowing in.

Late Thursday, a group of mainly Iranian migrants with small children agreed to stop manning barricades that prevented refugees from entering Macedonia, and about 300 people crossed the border from the Greek village of Idomeni. Tired of waiting, thousands of refugees then broke through a Greek police cordon, surging to the Macedonian border, which immediately closed again.