Eurosceptic anti-immigrant movements across Europe received a boost on Sunday when Switzerland voted by the slimmest of margins to impose quotas on newcomers to the country, thrusting its relations with the EU into uncertainty.

In a referendum mobilised by far-right populists demanding caps on immigration in a country where almost one in four of the population are immigrants, 50.4% of voters supported the measure, in a relatively high turnout of 56%.

The vote split Switzerland east to west, with the francophone west voting against the quotas and the German-speaking east backing the clampdown.

The European commission said it regretted the outcome of the Swiss vote and would need to review the impact on overall relations between Switzerland and the EU.

"This goes against the principle of free movement of people between the EU and Switzerland," the commission said.

While Switzerland is not an EU member, it is closely integrated with the union and is a member of Europe's passport-free Schengen regime. The vote to cap immigration throws this into question, undermining several bilateral agreements between Brussels and Berne, and challenging the Schengen system since the caps will also apply to EU citizens who previously enjoyed unfettered travel and working rights in Switzerland under the open borders system.

A little more than three months before elections to the European parliament, in which far-right anti-immigration populists are expected to make gains, the Swiss verdict is certain to galvanise the more extreme wings of European politics and chasten the mainstream.

France's National Front, tipped to come first in the French European elections in May, was quick to congratulate the Swiss voters on their verdict. Similar anti-immigrant parties are doing well in the Netherlands, Austria and Scandinavia.

The results may also be seized on in Britain, where David Cameron espouses similar policies of curbing freedom of movement within the EU and setting caps on those allowed to migrate from future new EU members.

The situations are different: Switzerland is not in the EU but in Schengen, while Britain is an EU member but not part of the Schengen system. However, freedom of movement for EU citizens is a central pillar of the EU's single market and applies both to the union and to the Schengen countries.

The Swiss yes vote came as a surprise since opinion polls had shown a majority against the quotas in a country that is one of the world's wealthiest and most successful, with a jobless rate of less than 4%, the lowest in Europe.

The vote, organised by the arch-conservative and Eurosceptic Swiss People's party, raises the prospect of Switzerland having to quit the Schengen system, which it joined in 2002, and its citizens forfeiting passport-free travel across most of Europe.

Brussels may also demand the renegotiation of several bilateral agreements with the Swiss regulating the neutral country's access to Europe's single market.

About 80,000 EU citizens freely settle in Switzerland every year, most coming from Germany but with large numbers also coming from neighbouring Italy and France.

The government opposed the quotas, as did Swiss business leaders. The government now has to come up with new legislation fleshing out the detail within three years.