European nations moved to reverse decades of unfettered travel across the continent when a majority of EU governments agreed the need to reinstate national passport controls amid fears of a flood of immigrants fleeing the upheaval in north Africa.

In a serious blow to one of the cornerstones of a united, integrated Europe, EU interior ministers embarked on a radical revision of the passport-free travel regime known as the Schengen system to allow the 26 participating governments to restore border controls.

They also agreed to combat immigration by pressing for "readmission accords" with countries in the Middle East and north Africa to send refugees back to where they came from.

The policy shift was pushed by France and Italy, who have been feuding and panicking in recent weeks over a small influx of refugees from Tunisia. But 15 of the 22 EU states which had signed up to Schengen supported the move, with only four resisting, according to officials and diplomats present.

The issue will be discussed at a summit of EU prime ministers and presidents next month. But the "reforms" of the Schengen system also need to go through the European parliament, where there is likely to be strong resistance to empowering national governments to reinstate controls.

The border-free region embraces more than 400m people in 22 EU countries, as well as Switzerland, Liechtenstein, Norway and Iceland. It extends from Portugal to Russia's borders on the Baltic, and from Reykjavik to Turkey's border with Greece.

The move to curb freedom of travel came as the extreme nationalist right, which is increasingly influencing policy across Europe, chalked up a notable victory in Denmark, which announced it would unilaterally re-erect controls on its borders with Germany and Sweden.

The centre-right minority government in Copenhagen capitulated to the fiercely anti-immigrant nationalists of the Danish People's party to secure parliamentary backing for long-term budget, welfare and retirement policies. "I have worked hard for this," said Pia Kjaersgaard, the far-right leader.

Despite the 'fortress Europe' mood gripping EU leaders, the Danish decision stunned many because it was taken just hours before an emergency EU meeting devoted to immigration and the Schengen regime.

The German government complained that the open border should not be "sacrificed for domestic political reasons".

The European commission said it would scrutinise the decision to see if it complied with the Schengen rules. There were calls in the European parliament for Denmark to be kicked out of the Schengen regime. But the Danish government promised that border and customs checks would not extend to passport controls, and that this remained compliant with Schengen.

Denmark already has the tightest anti-immigration laws in Europe. The government there said a permanent return to national controls was aimed at combating cross-border crime.

The sudden shift in Denmark, as well as the new curbs on freedom of movement, highlighted how a resurgent Europhobic far right across the EU is translating success at the ballot box into policy victories.

Italy's anti-immigrant campaign is headed by the interior minister Robert Maroni, of the xenophobic Northern League in the Berlusconi coalition. The campaign in France is seen as an attempt by President Nicolas Sarkozy to dilute the growing appeal of Marine Le Pen, the new leader of the extreme Front National.

The minority centre-right coalition in the Netherlands, as in Denmark, is propped up by tacit support from the Muslim-baiting Freedom party led by Geert Wilders.

The robust nationalism, most recently evident in Finland, is fuelling demands for the repatriation of powers from Brussels, a trend likely to be welcomed by David Cameron and the Tories.

"The problem is all about trust. How do we get out of this without bringing down the system?" said one EU ambassador. "The challenges get bigger every day and the question is whether all this can be kept under control."

The policy shift has also been triggered by acute nervousness about the impact of the Arab spring. "There are hundreds of thousands on the shores of north Africa. Something extraordinary could happen any day," said a senior EU diplomat. "If Gaddafi uses this weapon, he can create a lot of problems for Europe."

The Guardian revealed this week that the Gaddafi regime is allowing thousands of sub-Saharan African migrants on to overcrowded, unseaworthy ships in an apparently calculated attempt to use migration to pressure Nato and the EU countries against backing Libya's rebels.

While a consensus has emerged among EU governments on rowing back on Schengen, the European commission maintained that national passport and border controls could only be reintroduced "as a last resort", temporarily in extreme circumstances.

The commission's emphasis paves the way for a power struggle in the weeks and months ahead over who should police the Schengen rules and decide whether and why a country may suspend the open-borders regime.

At Thursday's meeting, Germany insisted the powers had to rest with national governments and that the European commission would be bypassed. It was supported by France, Austria, and the Czech Republic.

Cecilia Malmstrom, the commissioner for home affairs – who calls the borders-free zone a "beautiful achievement" – argued that the powers should be vested in Brussels.

Sándor Pintér, the Hungarian interior minister, who chaired the meeting, warned that individual countries should not be allowed to act alone in deciding to restore border controls. "That could trigger a chain reaction and shatter confidence," he said.

• This article was amended on 13 May 2011. The original misspelled the name of the Hungarian interior minister as Sandor Pinder. This has been corrected.