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.

The U.N. refugee agency says three Balkan countries shut their borders overnight to migrants from nations that are not directly engulfed in war.

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. Slovenia also said it has closed its border for the so-called economic migrants.

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 Palestine, she said.

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

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

Croatia has refused 162 migrants rejected by Slovenia.

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 media say 70 migrants from Morocco and Ivory Coast have been turned back by the Slovenes in the past few days.

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.

___

Associated Press writers Elena Becatoros, in Athens, and Jovana Gec, in Belgrade, Serbia, contributed.