The first group of migrants has reached Croatia – a new route to northern European Union countries, a day after Hungary sealed its border with Serbia.
About 150 migrants crossed into the EU country from neighbouring Serbia.
Croatia says it is ready to receive them “or direct” them to where they want to go. Many migrants – mainly Syrian – are hoping to reach Germany.
New border restrictions and a row over allocating migrants have shown bitter divisions in Europe over the crisis.
Hundreds of migrants remain stranded outside or in makeshift tents close to the Serbian border with Hungary.
On Tuesday, Hungary declared a state of emergency in the area, with hundreds of army and police deployed to enforce new laws making it an offence to breach a razor-wire border fence.
Police sealed a railway crossing point near Roszke which had been used by tens of thousands of migrants to enter the European border-free Schengen zone.
The move has all but stopped the inflow. On Wednesday, Hungarian police said they had detained 367 migrants entering illegally – and the first criminal proceedings have been launched.
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.
Many are fleeing conflict and poverty in countries including Syria, where a civil war has been raging since 2011.
The migrants have been crossing from Turkey, with about about 1,000 in the city of Edirne on Wednesday, waiting to organise a crossing into Greece. Their journey would then take them to Macedonia and Serbia.
Until Monday, most poured into Schengen member Hungary and crossed into Austria to reach Germany. Both Germany and Austria have introduced tighter border controls to control the flow.
‘We will help’
A group of about 40 migrants arrived in the border town of Sid in Serbia on Wednesday. They had travelled by bus from the Serbian town of Presevo near the Macedonian border in the south.
“We heard that Hungary was closed so the police told us we should come this way,” Amadou, 35, from Mauritania told AFP news agency.
“We don’t know what we should do now. Do we have to catch a boat?”
They crossed into Croatia where police began registering them.
Croatia’s Prime Minister Zoran Milanovic told parliament authorities were “entirely ready to receive or direct those people where they want to go, which is obviously Germany or Scandinavian countries”.
“They will be able to pass through Croatia and we will help, we’re getting ready for that possibility,” he said, contradicting an earlier statement by one of his ministers.
A meeting of the Croatian National Security Council has been called to co-ordinate the response.
The Serbian minister in charge of the government’s working committee on migrants, Aleksandar Vulin, argued that the closure of the border by Hungary was unsustainable for Serbia.
He told the BBC’s Lyse Doucet that contact between Serbian and Hungarian officials had been minimal.
Analysis: BBC’s Guy Delauney, Belgrade
All year, Serbia has taken a relaxed attitude towards the migrants and refugees entering from neighbouring Macedonia.
The authorities understood that few of the people coming in would want to stay, although some expressed regret that people desperately fleeing conflict did not view Serbia as a desirable destination.
But Hungary’s fence and its criminalisation of unofficial border crossings has brought a halt to the flow of people across Serbia.
If an exit into Hungary becomes impossible, the number of refugees here may begin to rise, challenging not only the country’s capacity for dealing with asylum seekers but its citizens’ hitherto admirable tolerance and empathy.
Hungary has also said it could extend its fence to the border with Romania – a possible new route.
Romania said this would violate the “European spirit” of co-operation.