Hungary has declared its southern border with Croatia closed to what it calls "illegal migrants", diverting them into Slovenia in a measure of Europe's disjointed response to the flow of people reaching its shores in flight from war and poverty.

A last train drew up at the border, and about 2,000 refugees disembarked for the short, muddy walk past razor wire into Hungary prior to a midnight cut-off time expiring on Friday night.

"The 'green border' has been closed [to 'illegal migrants'] but you can still cross the border legally and seek asylum," government spokesman Zoltan Kovacs told the AFP news agency early on Saturday.

Inside Story: Can the flood of refugees into Europe be stopped?

Hungary has erected a steel fence almost the length of its southern frontier, declaring it is duty-bound to secure the borders of the European Union to protect what it calls the prosperity, security and "Christian values" of Europe.

Hungarian Foreign Minister Peter Szijjarto said on Friday that the government was aware that the situation is not ideal.

"We know that this is not the best - only the second-best solution," he said.

"But the best solution did not come about [on Thursday] at the European Council meeting as there is no agreement on the protection of the external borders of Greece."

A month ago, the right-wing government of Hungary's fiercely anti-immigration prime minister, Viktor Orban, shut down the refugee route across its frontier with Serbia, slamming the door on thousands of refugees.

They were diverted into Croatia, from where they entered Hungary, crossing in recent weeks at a rate of 5,000 to 8,000 a day en route to Austria and Germany, the preferred destinations for most refugees.


RELATED: Al Jazeera's comprehensive coverage of the European refugee crisis


With that route now sealed, too, Croatia said it had a plan in place to send them to Slovenia starting at midnight, in agreement with its fellow former Yugoslav republic.

Both Croatia and Slovenia indicated they would not restrict the flow so long as Austria and Germany kept their doors open.

But the scale threatens to test the resources of Slovenia, an Alpine state of two million people, and of Croatia and Serbia if a backlog builds, with weather conditions deteriorating fast.

Confirming "operational talks" with Croatia, Slovenia said it would convene its national security council on Saturday.

"If Germany closes its border or restricts border crossings, then Slovenia will act accordingly," Slovenian Foreign Minister Karl Erjavec told a news conference.

"But so far there are no indications or information that Germany is to change its policy."

The EU has agreed to a deal - resisted by some of its members in Eastern Europe, including Hungary - to share out 120,000 refugees, only a small proportion of the 700,000 or so people expected to reach Europe this year.

An EU plan to offer Turkey more than $3bn and other incentives to help stop the flow of refugees from its borders appeared to come unstuck on Friday, when Turkish President Recep Tayyip Erdogan accused Europe of failing to share the burden of the growing refugee crisis.

"They announce they'll take in 30,000 to 40,000 refugees and then they are nominated for the Nobel [Peace Prize] for that. We are hosting two and a half million refugees but nobody cares," Erdogan said.

Source: Al Jazeera and agencies