Hundreds of people today marched out of a Greek transit camp, hiked for hours along muddy paths, and forded a rain-swollen river to get around a border fence and cross into Macedonia.

Authorities said they were detained after they crossed the border.

A Macedonian police spokeswoman said the several hundred migrants who had crossed into Macedonia would be sent back to Greece.

A Reuters photographer put the number who crossed as high as 2,000.

About 30 journalists, including a Reuters photographer, who followed the migrants were also detained, witnesses said.

Earlier, Macedonian police said three migrants - two men and a woman - had drowned crossing a river near the Greek border that had been swollen by heavy rain.

The crossing put the migrant issue back in the spotlight days before leaders from the European Union and Turkey are due to meet again to seal an agreement intended to keep migrants in Turkey from moving to Europe through Greece.

At least 12,000 people, including thousands of children, have been stranded in a sprawling tent city in northern Greece, their path to the EU blocked after Macedonia and other nations along the so-called Western Balkan route closed their borders.

Over 1,000 people streamed out of the camp, searching for a way around the twin border fences Macedonia built to keep them out.

A second group of migrants, many of them from war zones in Syria and Iraq, later followed them.

Heading west along muddy paths, the migrants, wrapped in coats and hats, carried their belongings in rucksacks and bags.

Many were children, some walking, others riding in strollers. Some made victory signs as they walked.

When they reached a river, they stretched a rope across it and formed a human chain to cross. They carried children across on their shoulders.

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 the migrants in army trucks.

"We are taking measures to return the group to Greece," the Macedonian police spokeswoman said.

Petros Tanos, a police spokesman in northern Greece, said police were investigating media reports that leaflets had circulated in the Idomeni camp urging migrants to march today.

"We do not know who produced it ... nor how they found the ropes yet," he said, referring to the ropes used to cross the river.

Babar Baloch, regional spokesman for UN refugee agency UNHCR, said conditions in the Idomeni camp were difficult after days of heavy rain.

"This is not a proper camp. People are exhausted, tired and running out of patience," he said.