Bosnian police briefly closed a border crossing with EU member Croatia on Monday to block a group of migrants who were trying to walk through woodland to reach the wealthy bloc, the border police said in a statement.
Croatia also sent police on its side of the border, Anel Ramic, the interior minister of the Bosnian northwestern Unsko-Sanski canton, said.
"Croatia sealed its borders," Ramic said at a news conference in the Bosnian town of Bihac. There was no immediate comment from Croatian authorities.
The head of the International Organisation for Migration (IOM) in the Western Balkans posted a video on Twitter showing hundreds of migrants, mostly men with rucksacks and some children, walking through the woods towards the Maljevac border crossing.
"Very worrying development that risks to create backlash that is not in interest of anyone," the IOM's Peter van Der Auweraert tweeted.
A post on the Maljevac Border Crossing Facebook page said that police forces from Bosnia and Croatia were deployed on both sides of the crossing, which was closed with travellers diverted to other locations.
The crossing was later re-opened and police were negotiating with the migrants to move away from the frontier, the statement from the border police said.
It was not immediately clear why the incident flared up on Monday, but the improving weather of the European summer often prompts migrants stranded in the Balkans to make attempts to reach the EU.
In 2015, more than a million migrants crossed into Europe from North Africa and the Middle East, often fleeing poverty at home, although relatively few went through Bosnia.
This year, more than 6,500 people from Asia, North Africa and Middle East have entered Bosnia from Serbia and also using a new people smuggling route from Greece via Albania, Montenegro and Bosnia to Croatia and onto western Europe.
Authorities have said that about 30 percent of them remain in Bosnia, and that most of them have been accommodated in asylum centres.
But most migrants head towards the western towns of Bihac and Velika Kladusa, where authorities estimate their numbers at about 3,000.
On Sunday, the Bihac police conducted a raid on buildings where migrants are housed after a 24-year-old migrant from Morocco was killed in a fight on Saturday.