Two trains carrying around 350 refugees spent Wednesday stuck in Rödby, on Scandinavia's busiest ferry crossing to Germany, around 135 kilometres southeast of Copenhagen.
The refugees refused to register with Danish authorities, which would mean having to apply for asylum in Denmark or returning to Germany, whereas most want to seek a new home in Sweden, which accepts more asylum seekers per capita than any other EU nation and where many have relatives.
Some people had tried running from the trains but most of them were detained by police and taken to a refugee centre.
After lengthy negotiations, around 100 of those onboard agreed on Wednesday evening to remain in Denmark and lodge their asylum request there.
Later on Wednesday night, the trains were cleared to continue on to Copenhagen, with around 240 people remaining onboard, a spokeswoman for the railway company DSB said. By Thursday morning, services were understood to be running as usual.
Meanwhile, ferry operator Scandlines announced that only passengers travelling by car would be let board ferries between Rödby and Puttgarden in Germany.
The ferries usually carry both cars and trains.
DSB had also cancelled all trains running to Germany running through Padborg, a border town in the western Jutland region.
“All train traffic to and from Padborg station has currently been stopped for the safety of those who are at the station,” local police wrote on Twitter.
The police said the decision had been taken “in consultation with German authorities”, for “security reasons”.
A refugee on a train at Rödby. Photo: Tore Meek/TT/Scanpix
The German government had yet to comment Wednesday evening. Deutsche Bahn railways claimed it had no hand in the decision to suspend the rail links.
“We don't know how long it will last,” a Deutsche Bahn spokesman said.
Police on Wednesday also closed part of a motorway near Padborg for a few hours after around 300 refugees, including large numbers of women and children, set off on foot for Sweden, the second large attempted march north this week.
The migrants had been housed in an old school building after arriving in the town but took to the road, saying they wanted to travel north to Sweden, where asylum conditions are more generous.
Some elderly migrants called off their 300-kilometre trek (186 miles) to Copenhagen, the jump-off point for crossings by bus, train or car to Sweden.
On Wednesday afternoon, the rest of the group left the motorway to spend the night in a local community.
Sweden has become a top EU destination for refugees by issuing permanent residency to all Syrian asylum seekers.
In contrast, Denmark has sought to reduce the influx by issuing temporary residence permits, delaying family reunifications and slashing benefits for newly-arrived immigrants.