Hungarian riot police have fired tear gas and water cannon to force refugees and migrants back from the Serbia-Hungary border.
Hundreds of people have massed at a closed crossing point near the Serbian town of Horgos, and have been involved in a tense stand-off with police on the other side of the border.
Police fired teargas and water cannon as dozens of young men threw stones in the searing heat and chanted "open the door".
Many of the refugees and migrants want to reach Germany via Hungary.
Tens of thousands of refugees and migrants have crossed the border in this area to enter the Europe Union's Schengen zone, which normally allows people to travel between member countries without restrictions.
Hungary closed its entire border with Serbia on Tuesday after enacting laws that make it illegal to enter the country or damage a new razor-wire border fence. The country's courts have started fast-track trials of arrested migrants.
Serbia's foreign ministry - which has protested over the firing of tear gas and water cannon into its territory - says Hungary has now closed the main border crossing between the two countries to all traffic for 30 days.
There were chaotic scenes near Horgos, with fires burning and police vehicles and ambulances arriving on the Serbian side of the border, across from the massed ranks of Hungarian riot police on the other side.
The firing of tear gas and water cannon created a panicked stampeded of refugees and migrants away from the border.
Several people received medical treatment from the Serbian ambulance service on the other side of the border, some suffering the effects of tear gas.
The Hungarian government says 20 police officers were injured during an attempt by refugees and migrants to break through the border.
Migrant Amir Hassan, from Iraq, said: "We fled wars and violence and did not expect such brutality and inhumane treatment in Europe.''
UN Secretary General Ban Ki-moon has said he is "shocked" and that the treatment of migrants in this way is not acceptable.
Meanwhile, Croatia has said it will allow refugees and migrants to travel on to northern Europe, opening up a new route a day after Hungary sealed its border with Serbia.
A steady stream of refugees and migrants is crossing into Croatia from Serbia, with some of those stranded on Serbia's border with Hungary now using the same route.
New border restrictions and a row over allocating refugees and migrants have exposed bitter divisions in the European Union over the crisis.
- BBC