Hundreds of migrants are stranded at the Serbia-Hungary border after the Hungarian government closed the frontier with a new razor-wire fence.
The move aims to stop migrants who are trying to enter the EU.
After new Hungarian laws came into effect overnight, police sealed a railway crossing point that had been used by tens of thousands of migrants.
Some have been searching for a way through the fence, while others threw down food and water in protest.
Hungarian Foreign Minister Peter Szijjarto has suggested his country is planning to build a fence to keep migrants out along part of its border with Romania - a fellow EU member - to prevent the bypassing of the current frontier.
The EU is facing a huge influx of migrants, many fleeing conflict and poverty in countries including Syria, where a civil war has been raging since 2011.
The EU's border agency says more than 500,000 migrants have arrived at the EU's borders this year, compared with 280,000 in 2014. The vast majority have come by boat across the Mediterranean.
A Serbian government minister, Aleksandar Vulin, argued that the closure of the border by Hungary was unsustainable. "They will have to open the border," he insisted.
In other developments on Tuesday:
- Twenty-two people, including four children, drowned after a wooden boat following the most popular recent migrant route, between Turkey and Greece, sank; 249 of those on board were rescued
- 179 refugees pulled the emergency brake cord on a train between Munich and Berlin before stepping off in Saxony, German media say
Hungary declared a state of emergency in two southern counties as the new laws came into force.
Anyone who crosses the border illegally will face charges, and 30 judges have been put on standby to try offenders.
The laws also make it a criminal offence - punishable by prison or deportation - to damage the newly built 4m (13ft) razor-wire fence along Hungary's 175km (110 mile) border with Serbia.
Police buses will now take asylum applicants to registration centres, but if their applications are refused they will now be returned to Serbia rather than being given passage through Hungary.
The state of emergency gives police extra powers and could allow the deployment of troops, if parliament approves.
At the scene: James Reynolds, BBC News, on the Serbia-Hungary border
Right next to the border, refugees and migrants are searching in desperation for ways into Hungary. One group from Afghanistan crowded in front of a portable cabin built into the fence. A boy tried to open the door handle. The group hoped that this cabin might be a new front door into the European Union. But no-one answered them.
A few metres away, another group began a protest. They sat on the road and threw their bottles of water and loaves of bread into a pile. "We don't want food or water until we cross the border," shouted one man.
An hour later, a crowd right next to the border fence started to move forward. The hunger strikers abandoned their protest to join the bigger crowd - in the hope of finding a way into Hungary. But I didn't see anyone being allowed to cross.