SKOPJE - Macedonia has closed its border completely to illegal migrants after Slovenia, Croatia and Serbia announced tight new restrictions on migrant entry, a police official said on Wednesday.

Thousands of migrants have built up on the Greek side of the Macedonian border. Macedonia had been allowing small numbers of Syrians and Iraqis through but stopped this after its neighbours tightened up their policies.

“We have completely closed the border,” the police official, who declined to be named, told Reuters.

According to the Macedonian Interior Ministry, no migrants entered from Greece on Tuesday.

“Macedonia will act according to the decisions taken by other countries on the Balkan route,” an Interior Ministry spokesman said, referring to the main routes taken by more than a million migrants to reach the European Union over the last year.

Slovenia, Croatia and Serbia said on Tuesday they would place new restrictions on the entry of migrants. The decisions were announced hours after EU leaders outlined an agreement intended to end a mass movement to reach wealthy countries in Europe from war zones.

Croatia’s Interior Minister Vlaho Orepic told a news conference on Wednesday in Zagreb that the new decision meant reestablishing of a “regular border regime”.

“The essence of this is to firmly stick to a regular border regime and to be ready to react to any exceptional circumstances,” Orepic said. He added that talks were proceeding on return of 408 migrants, currently stranded in a camp in Croatia, to Greece.

Around 1,000 migrants remain stranded in a refugee camp on the Macedonian side of the Serbian border while more than 400 are stranded in “No Man’s Land” between Serbia and Macedonia.

They refuse to go back to Macedonia and are not being allowed to cross in to Serbia.

Meanwhile, Slovenia and neighbouring Croatia will from Wednesday refuse the transit of most migrants through their territory in a bid to seal off the Balkan route used by hundreds of thousands of people seeking a new life in Europe, officials said.

The latest twist in Europe’s migrant crisis could set off a domino effect among Balkan states, with Serbia indicating it would follow Ljubljana’s lead and Macedonia apparently set to so the same.

The moves to shut down the main route used by the vast influx of migrants hoping to find asylum or better economic prospects in northern Europe come barely a day after the EU and Turkey agreed a proposal aimed at easing the crisis.

EU officials hailed Monday’s deal with Ankara as an important breakthrough, but the head of the UN refugee agency cast doubt on its legality, while Amnesty International said the plan “dealt a death blow to the right to seek asylum”.

Slovenia’s interior ministry said late Tuesday that from midnight (2300 GMT), access would only be granted to “foreigners meeting the requirements to enter the country”, those wishing to claim asylum, and migrants selected “on a case by case basis on humanitarian grounds and in accordance with the rules of the Schengen zone”.

Fellow EU member Croatia, which is not part of the passport-free Schengen zone, said it would follow Slovenia’s lead and refuse transit to most migrants as of midnight.

“Apparently Europe has decided to start a new phase in resolving the migrant crisis. It was concluded that on the Schengen zone borders the Schengen rules would be applied,” Interior Minister Vlaho Orepic told RTL commercial television.

Croatia, which had already limited the number allowed to enter, would now only allow in migrants with proper visas. “The border of Europe will be on the Macedonia-Greek frontier and we will respect the decisions which were made,” he said.

More than a million people have crossed the Aegean Sea into Greece since the start of 2015, many from Syria, Afghanistan and Iraq and most aiming to reach wealthy Germany and Scandinavia, causing deep divisions among EU members about how to deal with Europe’s worst migration crisis since World War II.

Serbia said that following Slovenia’s move, it would “align all measures with the European Union” and impose the same restrictions at its borders with Macedonia and Bulgaria.

Slovenia and Serbia, along with Austria, Croatia and Macedonia, have dramatically restricted entry to migrants in recent weeks, leaving a bottleneck of some 36,000 stuck at the Greek-Macedonian border, unable to continue their journey.

Macedonia said it would only grant entry to the number of migrants that will be allowed to transit through neighbouring Serbia and on towards Europe.

Turkey, currently hosting 2.7 million Syrian refugees, is the key springboard for migrants making the perilous sea crossing to Greece. Efforts to stem the flow have failed, with nearly 2,000 migrants landing on the overstretched Greek islands every day in February.

At talks in Brussels on Monday, the EU agreed in principle to a Turkish proposal to take back all illegal migrants landing on the Greek islands.

Ankara also proposed an arrangement under which the EU would resettle one Syrian refugee from camps in Turkey in exchange for every Syrian that Turkey takes from Greece, in a bid to reduce the incentive for people to board boats for Europe.

European Commission chief Jean-Claude Juncker called the plan a “real game-changer” and insisted it was “legally feasible”, but it sparked concern from UN refugee chief Filippo Grandi.

“As a first reaction I’m deeply concerned about any arrangement that would involve the blanket return of anyone from one country to another without spelling out the refugee protection safeguards under international law,” Grandi told the European Parliament.

Rights group Amnesty International said the proposal was full of “moral and legal flaws” and along with Human Rights Watch challenged the idea that Turkey was a “safe country” to which migrants could return.

“The idea of bartering refugees for refugees is not only dangerously dehumanising, but also offers no sustainable long-term solution to the ongoing humanitarian crisis,” Amnesty’s Iverna McGowan said.