BUDAPEST, Hungary -- Hungary shut down its border with Croatia to the free flow of migrants on Saturday, 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 (2200 GMT Friday).
Several hundred migrants who reached the border minutes before the deadline would still be allowed to enter Hungary for humanitarian reasons, government spokesman Zoltan Kovacs told reporters in the border village of Zakany.
"The Hungarian government has taken the steps ... to protect the internal European freedoms and the security of the citizens of Hungary and Europe," Kovacs said minutes after the shutdown.
Hungary decided to order the border clampdown after EU leaders who met Thursday in Brussels failed to agree on a plan backed by Hungary to send EU forces to block migrants from reaching Greece.
"We know that this is not the best, but only the second-best solution," 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," 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. Migrants could still apply for asylum in Hungary at two border transit zones, Szijjarto said.
Over 383,000 migrants 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 Sept. 15 and since then migrants have been taking a detour through Croatia to reach Hungary.
"We have every hope that the introduction of the border closure (with Croatia) will have the same positive effects as what we experienced on the border with Serbia," said Gyorgy Bakondi, senior adviser to Prime Minister Viktor Orban.
Croatia will now start sending migrants to its border with Slovenia, another EU country in the Schengen zone, which also shares borders with Hungary and Austria.
Slovenia said Friday it would beef up border controls and create entry points for migrants to manage the influx, but would keep accepting migrants 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.
"There is no way Croatia can cope with ... accommodating and providing for the immediate needs for these people," said Lydia Gall, a researcher for Human Rights Watch in Budapest. "Within days you would end up having tens of thousands of people in Croatia and further down the Western Balkan route, in Serbia and Macedonia."
Hungary's fellow members of the so-called Visegrad Group -- Poland, the Czech Republic and Slovakia -- are sending dozens of soldiers, police and equipment to support Hungarian forces guarding the border with Croatia.
Hungarian officials said this co-operation would be an example to the rest of the EU regarding joint border protection.
Since Hungary erected the fence on the Serbian border, hundreds of migrants have breached the barrier, which is considered a criminal offence.
On Friday, the cases of 16 men accused of entering Hungary illegally were tried in a court in the southern city of Szeged.
Sitting in the hallway of the court, Rajab Al Khalil said he was trying to reach Germany and escape the Islamic State group controlling his hometown.
"I did not know which country I was in until I saw the Hungarian flag on the uniform of police," said Al Khalil, a 28-year-old Kurd from the Iraqi city of Mosul. "If I can leave, I will never come back here."
Like many of the other 15 men whose cases were tried Friday, he was expelled from Hungary for one year just a day after entering the country. Since Serbia is refusing to accept migrants expelled by Hungary, Al Khalil will join over 460 others awaiting expulsion in detention centres or in separated facilities inside Hungarian prisons.
Hungary has declared it does not want to take in any migrants and has granted asylum or other forms of international protection to only a few hundred refugees this year.
Balint Szlanko in Zakany, Hungary, and Jovana Gec in Belgrade, Serbia, contributed to this report.