Swiss voters have narrowly backed proposals to reintroduce immigration quotas with the European Union, acccording to Swiss television.
In a close vote, 50.3 percent backed the "stop mass immigration" initiative, which also won the required majority approval in more than half of Swiss cantons or regions, Swiss television said.
The outcome obliges the government to turn the initiative, lead by the conservative Swiss People's Party, into law within three years.
The new measure will leave it up to authorities to set quotas for foreigners' work permits per sector.
It reflects growing concern among the Swiss population that immigrants are eroding the nation's distinctive Alpine culture and contributing to rising rents, crowded transport and more crime.
Net immigration runs at an average of 70,000 people a year. Foreigners make up 23 percent of the population of eight million, second in Europe only to Luxembourg.
The majority of recent immigrants are from neighbouring Germany, Italy and France, as well as Portugal.
While neutral Switzerland is not a member of the EU, its immigration policy is based on free movement of citizens to and from the EU, with some exceptions, as well as allowing in a restricted number of non-EU citizens.
That pact on free movement of people is now in danger of unravelling.
The European Commission in Brussels said in a statement that the vote went against the principle of free movement of people.
It said it would examine the implications for its relations with Switzerland, taking into account the position of the government, which had urged citizens to vote "no".
Didier Burkhalter, the Swiss foreign minister, said he planned to tour European capitals to explain the vote and seek a solution, starting with Berlin.
"The people are sovereign, and a healthy system doesn't force the public to follow political authorities with outsized powers," Burkhalter said.
The Swiss system of direct democracy - which allows for up to four national referenda per year - means popular dissatisfaction can be translated into action relatively easily.
|Swiss journalist discusses vote
The provisions of the initiative require the restriction of residence permits for foreign nationals, including cross-border commuters and asylum seekers, according to quotas, the government said in a statement.
These limits will now need to be defined at a legislative level, it said.
The EU is Switzerland's biggest trading partner, buying $122bn of goods in 2013.
Opponents of the move say it could exacerbate a shortage of skilled workers in Switzerland, the home of Roche, Novartis, UBS and other multinationals filled with foreign professionals.
The vote was watched closely by eurosceptics within the EU who want to rein in immigration among its member states, notably from eastern to western Europe.