Danish police have closed a motorway and rail links with Germany in a bid to stem the flow of refugees heading into the country, then north to Sweden.
The motorway, which is a vital route for people and goods between the two countries, was closed when about 300 refugees, including children, began walking on it.
Police tried to persuade them to leave but witnesses say they were reluctant to use force.
Police also asked the state-owned railway operator to stop all trains between Germany and Denmark until further notice.
Vast numbers of people, many fleeing war and Islamic State in Syria, are trying to reach safety in EU countries willing to have them.
While most Middle East refugees see Germany as their final European destination, Sweden is also a favourite as it also has more generous policies for refugees than other EU countries.
Denmark is part of the EU's Schengen zone, where borders are meant to be open to allow free movement.
At Rodby, where train ferries arrive in Denmark from Germany, two trains carrying about 240 people were stopped by police. Refugees on board were refusing to leave the train, police said.
About 100 foreign passengers left a train that was still on a ferry and were transferred to a school for registration.
Many refugees are reluctant to register in Denmark, where a centre-right government has cut benefits.