Hundreds of migrants who left a camp in northern Greece and tired to get around a barbed wire fence into Macedonia will be sent back to Greece.
Hundreds of migrants who marched out of a Greek transit camp to get around a border fence and cross into Macedonia will be sent back to Greece.
A Macedonian police spokeswoman said on Monday the "several hundred" migrants who had crossed into Macedonia would be sent back.
A Reuters photographer put the number who crossed as high as 2,000.
Around 30 journalists who followed the migrants were also detained, witnesses said.
At least 12,000 people, including thousands of children, have been stranded in a sprawling tent city in northern Greece, their path blocked after Macedonia and other nations along the so-called Western Balkan route closed their borders.
On Monday, more than 1000 migrants left the camp to find a way around the twin border fences Macedonia built to keep them out.
A second group of migrants later followed them.
Heading west the migrants, wrapped in coats and hats, carried their belongings in rucksacks and bags.
Many were children, some walking, others riding in strollers.
When they reached a river, the migrants stretched a rope across it and formed a human chain to cross.
Earlier, Macedonian police said three migrants - two men and a woman - had drowned crossing a river near the Greek border that was swollen after heavy rain.
Once over the river, the migrants walked along the border fence until they found the point where it ended in mountainous country.
But after they crossed the border, Macedonian soldiers rounded them up and put them migrants in army trucks.
"We are taking measures to return the group to Greece," the Macedonian police said.
Greek police did not try to stop the first group leaving, but blocked the second group from continuing.
The migrants managed to break through and went on.
UNHCR regional spokesman Babar Baloch said conditions in the Idomeni camp in Greece were difficult after days of heavy rain.
"This is not a proper camp.
"People are exhausted, tired and running out of patience," he said.
More than a million people fleeing war and poverty in the Middle East and beyond have flooded into the EU since early 2015.
Most made the perilous sea crossing from Turkey to Greece, then headed north through the Balkans to Germany.
The migrants crossed the border days before leaders from the EU and Turkey will meet again to seal an agreement intended to stop migrants in Turkey coming to Europe through Greece.
In Berlin, German Chancellor Angela Merkel said there was no question Germany, where anti-immigration sentiment is growing, has benefited from the closure of the Balkan migrant route.
Italian Prime Minister Matteo Renzi said it was time to end the selfishness of countries that thought raising a wall was a lasting response to the migrant challenge.