A Hungarian security officer fired three warning shots early on Tuesday after about 60 migrants and refugees tried to force their way through a checkpoint on the border with Serbia.
No one was wounded in the incident, which took place at the Roszke/Horgos border crossing, Hungarian police spokeswoman Szilvia Szabo said.
Serbian police said later they had arrested 37 people for trying to cross the frontier illegally.
Hungarian police said the group tried to enter the European Union member state at the crossing at about 04:30 GMT, prompting the security officer on site to fire the warning shots.
There are thousands of refugees and migrants stuck in Serbia, with more than 6,000 living in government-operated camps.
On Tuesday, in the village of Horgos, on the Serbian side of the border crossing, a group of about two dozen from Iraq, Syria, Afghanistan and Morocco said they were beaten up by Hungarian police and sent back to Serbia.
Some showed cuts and bruises, but Reuters was not able to verify their accounts.
“My friends they have tried to cross the border and the police of Hungary, they reacted badly about that, they were hitting them, they broke their phones,” said Mohab, a migrant from Morocco, who acted as an interpreter for the group.
“They shoot bullets in the air and people run,” he said.
The crossing was the scene of a large-scale clashes at the peak of Europe’s migrant crisis in 2015, when police faced off with hundreds trying to break through the frontier into the EU.
Hungarian Prime Minister Viktor Orban subsequently ordered a steel fence erected along Hungary’s border, curbing arrivals.
But migrant traffic started increasing again late last year and there are currently several hundred attempted undocumented crossings per week.
Most of Tuesday’s group failed to cross the border, and the four who managed to enter Hungary were intercepted, police said, adding that the crossing had been closed.
A larger highway checkpoint for international passenger and freight traffic remained open, police said.