Polfoto via Associated Press, Ernst van Norde
Danish police patrol the German-Danish border crossing at Padborg Denmark near Flensburg, northern Germany, Monday, Jan. 4, 2016. Germany says Europe’s system of passport-free travel across borders is in danger following the decision by Denmark to step up controls on its southern frontier with Germany.

COPENHAGEN, Denmark — Denmark and Sweden tightened border checks on Monday to stem the flow of migrants coming in from Germany, dealing fresh blows to the vision of a Europe without national boundaries.

As of midnight Sunday, Sweden demanded that all passengers traveling by train from Denmark show ID, something that hasn't been required since the 1950s.

Within hours of the Swedish measure taking effect, the Danish government announced it was stepping up controls of its border with Germany, to make sure that migrants headed for Sweden don't get stuck in Denmark.

"The government doesn't want Denmark to become a new big destination for refugees," Prime Minister Lars Loekke Rasmussen said.

The moves were the latest by European Union countries to suspend an agreement to keep internal borders open after 1 million migrants entered the 28-nation bloc in 2015, most of them by crossing the Mediterranean to Greece or Italy.

Loekke Rasmussen said if the EU can't protect its external border "you will see more and more countries forced to introduce temporary border controls."

Refugee rights advocates warned of a domino effect, with European countries tightening their borders one by one and cutting off the main migrant routes through Europe.

When the new Swedish rules were announced last month, the U.N. High Commissioner for Refugees said they "could have the effect of preventing individuals from exercising the right to seek asylum."

To comply with the new rules, passengers on Monday had to show identification to board trains departing from Copenhagen Airport to Sweden across a bridge-and-tunnel link. The move was meant to deter migrants, many of whom are entering illegally.

It appeared to have an immediate effect. Swedish police spokeswoman Ewa-Gun Westford said that as of midday Monday only one asylum-seeker had arrived by train across the bridge. At the height of the migrant crisis a few months ago, more than 1,000 asylum-seekers crossed the bridge daily.

In response, Denmark beefed up its border controls with Germany as of noon Monday (1100 GMT, 6 a.m. EST). The Danish prime minister said the move was necessary because the Swedish rules "could lead to more refugees and migrants being stopped on their journey northward, and therefore ending up with us in Denmark."

He said the Danish checks wouldn't be as far-reaching as the Swedish ones, entailing only "spot checks" on passengers on trains crossing the mainland border on the Jutland peninsula and on ferries arriving in the Danish ports of Gedser and Roedby. He said there would be no problem for "ordinary" Danes and Germans to cross the border.

"We are not talking about controlling everyone coming in from Germany," he said.

His center-right government has taken a series of measures to discourage migrants from coming to Denmark, including a proposal to seize their jewelry to cover their expenses in the country.

Sweden's left-leaning government initially had a welcoming attitude to migrants, but reversed course after more than 160,000 Syrians, Iraqis, Afghans and others applied for asylum in 2015, the highest number in Europe except for Germany.

German officials said Europe's system of passport-free travel across borders is in danger following the Scandinavian moves.

Foreign Ministry spokesman Martin Schaefer said that the so-called Schengen system of passport-free travel "is very important, but it's in danger due to the flow of refugees that we in Europe have indeed been struggling to deal with in the past months."

He echoed other German officials' calls for a pan-European agreement on how to control the movement of migrants across borders.

Interior Ministry spokesman Johannes Dimroth said Germany would carefully watch the Danish border controls to evaluate "whether and how this affects migration northward from Germany."

Germany introduced border controls of its own on the Austrian frontier in mid-September.

More than 190,000 migrants crossed the German-Danish border last year. About 13,000 applied for asylum in Denmark, while others traveled further north to Sweden, Norway and Finland, Loekke Rasmussen said.

Karl Ritter reported from Stockholm. Geir Moulson and Frank Jordans in Berlin contributed to this report.