Thousands of beleaguered migrants, including many women and children, have spent a night in rain and cold in the Balkans as the countries quarrel over how to handle the large influx of people.

Many were stranded at Croatia's border with Slovenia after Croatia sent a train there despite Slovenia's refusal to take the people into the country. The train carrying some 1,800 people arrived in the early hours of the morning Monday.

Croatian police ordered the migrants off the train, but Slovenian police were deployed to the border and put up iron fences to prevent a mass entry. For hours, the migrants sought ways to sneak into Slovenia on foot while Croatian police on the other side prevented them from turning back.

Slovenian police said they would first register women and children from the train and let them into the country, while the rest remained stranded out in the open on a field amid driving rain.

The border incident has caused a diplomatic spat between Croatia and Slovenia, with Slovenia accusing Croatia of breaching an earlier agreement that only 2,500 people can be transported into the country each day. That figure appeared to have been reduced by the Slovenes to 1,500 a day because they said that's how many neighboring Austria allow across its border each day.

Tension was also building among the thousands of migrants fleeing war and poverty in the Middle East, Africa and Asia and seeking to head toward Western Europe. They have been stranded in the cold weather in the Balkans since Hungary closed its border with Croatia early Saturday and the flow of people was redirected to the much slower route via Slovenia.

Hundreds of migrants were also left waiting in the mud on the border between Serbia and Croatia after Croatian police put up a fence to control the influx. On Monday, parents were seen handing over children to Croatian police across the metal barriers.

The reduced flow of the migrants on the so-called Balkan route could cause a large backlog of people in Croatia, Serbia and Macedonia.

"We are in cold weather and the place is not good ... our message for the governments is to take into consideration our suffering," said Farouk Al-Hatib from Syria at the border between Croatia and Serbia.