Dozens of migrants clashed with Bosnian police Wednesday while trying to cross from Bosnia into Croatia and enter the European Union.

Shouting “Open borders!” the migrants surged through one Bosnian police cordon before being stopped by another outside a border crossing in northwestern Bosnia.

Several people appeared to have been hurt amid the skirmishes as the migrants refused to leave and blocked traffic.

“We are refugees,” one man from Iran said. “We want to leave this country.”

Croatian police said they put up a fence on their side of the border to block the migrants from entering. They said two officers were slightly injured by rocks thrown by migrants.

Bosnian police earlier stopped some 100 migrants from getting off a train that arrived in the area early Wednesday. Officers organized their transfer to a migrant center in the capital of Sarajevo.

Police also turned back buses with migrants Wednesday to curb any new arrivals.

“Any increase in the numbers of migrants without adequate housing presents a potential security threat,” said regional police commissioner Mujo Koricic.

Thousands of migrants have been staying in northwestern Bosnia — many camping out in the open — while trying to cross into Croatia and journey onward to other EU countries. War-ravaged Bosnia has struggled with the influx, and some citizens have staged protests to demand a better humanitarian response from officials.

Migrants have walked to the Croatian border to draw attention to the borders remaining closed for people fleeing war and poverty. Dozens, including children, have spent the past two nights out in the open.