Four nations along Europe's Balkan refugee corridor shut their borders Thursday to those not coming from war-torn countries such as Syria, Afghanistan or Iraq, leaving thousands of others seeking a better life in Europe stranded at border crossings.

The overnight decision was exactly the domino effect that both asylum-seekers and European nations had feared would happen given the record number of people fleeing to Europe this year and new fears after the deadly Paris attacks of possible militants coming in with refugees.

Mohammed Mirzam, 30, from Afghanistan knows he will be let through, but his wife and two children, Ilia, 5, and Elena, 3, are Iranian nationals and will not.

"We're trapped," he said, from the Greek side of the border, at Idomeni. "They won't let my family across. We have no money, and we're waiting without any idea of what is to happen."

Macedonia was not allowing in from Greece people from Morocco, Sri Lanka, Sudan, Liberia, Congo or Pakistan, the UNHCR spokeswoman in Serbia, Melita Sunjic, said Thursday.

On the Serbian border with Macedonia, the Serbs were only letting in migrants from Syria, Afghanistan and Iraq. And on the Croatia-Serbia border, Croats were only accepting people from those three countries, plus Palestinians, she said.

Slovenia — the next country in the chain — also said it has been turning back the so-called economic migrants.

Serbia has turned back to Macedonia some 200 migrants and Macedonia has not let them in, Sunjic said.

"So they are stuck on a no man's land," she told The Associated Press.

EUROPE-MIGRANTS/GREECE

Migrants wait next to Greece's border with Macedonia, near the Greek village of Idomeni on Thursday. (Alexandros Avramidis/Reuters)

Croatia refused 162 migrants from Morocco rejected by Slovenia. Slovenia later Thursday said it will allow those migrants to proceed toward Austria.

"This is going to be definitely a challenging situation," Sunjic said. "UNHCR does not think that there is any nation that can be excluded from international protection based on their nationalities, but each case individually should be screened and processed based on the merits of the case."

In the Greek border area of Idomeni, police said the border has essentially been shut down to all since about 8 a.m. after roughly 300 people, mostly from Iran, gathered at the crossing seeking to also be allowed through. A further 2,500 people are waiting at a camp nearby that provides temporary shelter for those heading north through the Balkans.

The partial closure of the borders could trigger huge pileups of desperate people along the Balkan corridor that has seen hundreds of thousands of people cross as they head to wealthy EU states, mostly Germany. Although Syrians are the biggest group among the asylum-seekers, tens of thousands of people fleeing poverty — such as Pakistanis, Bangladeshis or Sri Lankans — have also joined the surge.

Serbian Labor Minister Aleksandar Vulin on Thursday blamed EU-members Slovenia and Croatia for the ban, saying they have started turning back economic migrants — those fleeing poverty, not war.

"We have to protect our country. That is why we have applied reciprocal measures toward the people Slovenia and Croatia have no room for," Vulin said.

Slovenia's decision to start turning back people it considers economic migrants triggered the chain reaction along the Balkan migrant route.

Slovenian police spokesman Drago Menegalia said in recent days, "there is increased number of persons who were recognized as pure economic migrants" entering the small Alpine state from Croatia.

"These foreigners do not qualify for international protection," according to EU laws, he said.

Slovenian officials say they will continue to allow the transit of refugees from war-ravaged countries such as Syria, Afghanistan and Iraq pass through on their way to Austria and other richer EU states.