The move has left hundreds of people stranded on borders

* Priority given to Syrians, Iraqis and Afghans

* North Africans, south Asians prevented from travelling on

* Hundreds stranded at borders (Updates with Macedonian border closed, Slovenian army)

By Branko Filipovic and Kole Casule

SID, Serbia/SKOPJE, Nov 19 (Reuters) - Balkan countries have begun filtering the flow of migrants to Europe, granting passage to those fleeing conflict in the Middle East and Afghanistan but turning back others from Africa and Asia, the United Nations and Reuters witnesses said on Thursday.

The move left hundreds of people stranded on borders. On Serbia's frontier with European Union-member Croatia about 400 were denied access to a train and were halted by Croatian police as they tried to cross the border through fields, a spokeswoman for the United Nations refugee agency (UNHCR), said.

Others were stuck in no-man's land between Macedonia and Greece, where Macedonia closed off access to all migrants regardless of nationality until a deal could be reached with Greece on how to filter them.

What has become the greatest migration of people on the European continent since World War Two has deeply divided the 28-nation EU and fuelled anti-immigration sentiment across the continent.

Calls by some right-wing European politicians to stop the influx have been fuelled by indications that one of the perpetrators of last week's attacks in Paris by Islamist militants, in which 129 people died, reached Europe by infiltrating the chaotic and often unchecked flow of migrants reaching Greek shores by boat and dinghy from Turkey and heading north through the Balkans.

UNHCR spokeswoman Melita Sunjic said Serbia had implemented a new approach from Wednesday: "As of 6 p.m. yesterday evening, Serbia started turning back (to Macedonia) all but Syrians, Iraqis and Afghans."

BALKAN TREK

Those three nationalities make up the majority of the hundreds of thousands of migrants who have trekked across the Balkans this year in the hope of reaching western and northern Europe, mainly Germany and Sweden.

However, Reuters reporters on Serbia's border with Croatia said others from Iran, Libya and Lebanon were also crossing.

Migrants arrived by bus at a petrol station near the Serbian border town of Sid, where police checked their papers. A police officer said they had been told not to let those from Algeria, Tunisia, Morocco, Bangladesh, Pakistan or Somalia board trains to Croatia.

Those denied further passage were taken to a nearby camp.

Officials in Macedonia and Serbia said they acted after Slovenia informed them it would no longer grant access to those deemed to be "economic migrants".

"We won't allow anyone to enter Serbia who cannot continue their journey," Serbia's pointman for the migration crisis, Aleksandar Vulin, told reporters.

"We must protect our country and that is why we have undertaken reciprocal measures towards those for whom Slovenia and Croatia consider there is no place," he said.

A police spokesman in EU-member Slovenia confirmed Ljubljana would start returning "economic migrants" arriving through neighbouring Croatia, saying it could only grant passage to those "from countries where there are armed battles".

The Slovenian Defence Ministry said it planned to call up about 200 of a total of 914 army reservists to help control the influx.

Croatia warned of a fresh risk of bottlenecks.

"The problem is not big at the moment, but may increase unless tackled at the source," Interior Minister Ranko Ostojic told reporters at a refugee transit camp in eastern Croatia. (Additional reporting by Alexandros Avramidis in IDOMENI, Greece, Igor Ilic in ZAGREB, Ivana Sekularac in BELGRADE and Marja Novak in LJUBLJANA; Writing by Matt Robinson; Editing by Janet Lawrence)

Our Standards: The Thomson Reuters Trust Principles.