Hungary has shut down its border with Croatia to the free flow of refugees, a move experts say could leave thousands of people on their way to western Europe stranded in the small Balkan nation.
Hungarian foreign minister Peter Szijjarto announced the decision after a meeting of the national security cabinet, and the border, reinforced with a razor-wire fence, was closed from midnight.
Several hundred refugees who reached the border minutes before the deadline would still be allowed to enter Hungary for humanitarian reasons, government spokesman Zoltan Kovacs said.
"The Hungarian government has taken the steps ... to protect the internal European freedoms and the security of the citizens of Hungary and Europe," Mr Kovacs said minutes after the shutdown.
Hungary ordered the border clampdown after EU leaders who met in Brussels failed to agree on a plan backed by Hungary to send EU forces to block refugees from reaching Greece.
"We know that this is not the best, but only the second-best solution," Mr Szijjarto said.
He said normal border checkpoints between the two countries would remain open, though inspections will be tightened. "We will introduce stricter controls to be able to block border crossings done illegally," Mr Szijjarto said.
Although Croatia is also a member of the European Union, unlike Hungary it is not part of the Schengen zone of passport-free travel. Refugees could still apply for asylum in Hungary at two border transit zones, he said.
More than 383,000 refugees fleeing war and poverty in the Middle East, Africa and Asia have entered Hungary this year, nearly all passing through on their way to Germany and other destinations further west in the EU.
The country clamped down on its border with Serbia with a similar fence on September 15 and since then refugees have been taking a detour through Croatia to reach Hungary.
Croatia will start sending refugees to its border with Slovenia, another EU country in the Schengen zone, which also shares borders with Hungary and Austria.
Slovenia said it would beef up border controls and create entry points for refugees to manage the influx, but would keep accepting refugees as long as Austria and Germany kept their borders open.
However, experts fear that many will get stuck in Croatia, which is ill-prepared to provide for them in large numbers.