VIENNA — Migrants traded punches and scuffled with police at a Serbian border crossing and a man was stabbed in a similar clash on the Slovenian border Thursday, as pent-up pressures on their trek toward hoped-for safe haven in the European Union boiled over.

Slovenian police said the stabbing took place near Rigonci earlier in the day, and that the victim was given medical treatment.

The unrest at Berkasovo village on the Serbian border subsided after several minutes. But the outbreak reflected the frustrations of the tens of thousands of people facing long waits and other hardships as they make their way north over the Balkans each day in search of better lives in prosperous EU countries.

Further along that route, Austrian police moved to relieve pent-up pressure that they feared could lead to violence, removing barriers at an overcrowded collection point at a border crossing with Slovenia. A day earlier, thousands of migrants broke through police obstacles at the same collection center.

Many of the migrants spilled out of the facility Thursday but then gathered nearby, following police instructions. But many others walked away from the border.

The collection area just inside the Austrian border was again full by afternoon. Police and soldiers struggled to maintain order as the crowd surged every time a group was separated for transport by bus to shelters and processing.

Trampled, pushed or otherwise hurt, several people were seen receiving medical attention. At least two adults were taken away on stretchers.

A police officer with a loudspeaker urged people to sit and wait for buses, warning “if you make trouble, we make trouble.”