Hungarian police have fired tear gas and water cannons at several hundred refugees protesting at being unable to cross the border from Serbia.
"The crowd on the Serbian side became aggressive and threw stones, bottles and sticks at police on the Hungarian side and crossed the barrier at the border," a police statement said on Wednesday.
Police called in reinforcement to handle the "aggressive" crowd and the barrier was "replaced by several ranks of police", it said.
"The police is protecting the border of Hungary and the EU while respecting the law and the principle of proportionality," it added.
An AFP reporter on the Serbian side said about 300 out of a group of 500 took part in the protest.
Children were crying from the effects of the tear gas, which causes respiratory problems as well as eye irritation.
There were also helicopters flying overhead.
The incident came after Hungary this week sealed its southern border with Serbia, cutting off one of the biggest entry points for migrants into the European Union this year.