Swiss voters rejected in a referendum a proposal to end an agreement with the EU on the free movement of people, according to television projections.
Broadcaster SRF said voters were ready to reject the plan by 63% to 37%.
The ballots are still being counted and the final results are expected within hours.
Switzerland is not a member of the EU, but currently accepts free movement in order to be able to access free trade and cooperate with Brussels in areas such as transport and education.
The proposal came from the right-wing Swiss People’s Party (SVP) and followed a 2014 referendum to introduce quotas on EU immigrants, which was narrowly passed.
Supporters of the anti-free movement plan have said it would allow Switzerland to control its borders and select only immigrants it wants.
Opponents argued that this would plunge a healthy economy into recession and deprive hundreds of thousands of Swiss citizens of their freedom to live and work across Europe.
People also voted on a number of other issues.
They appear to have supported paternity leave for new fathers and rejected a proposal to make it easier to hunt protected species such as wolves.
What are the possible consequences for Brexit?
The Swiss referendum was already in preparation before the United Kingdom voted to leave the EU in 2016.
The SVP used arguments similar to the Brexiteers to gain more control over immigration in a country they say is becoming increasingly overcrowded and expensive.
But net migration to Switzerland is actually declining right now, and there is a feeling voters are starting to tire of the party’s anti-immigration message.
Imogen Foulkes of the BBC in Geneva says a resounding yes to free movement of people could very well strengthen Brussels’ hand with London and signal the UK what kind of compromise might be needed to strike a free trade deal with the EU.
Chronology: Switzerland and the EU
1992: Switzerland votes from 50.3% to 49.7% against joining the European Economic Area – first step towards EU membership
1992-2002: Switzerland negotiates, then signs the first bilateral agreements with the EU – they are interdependent and include the free movement of people – supported by a vote in 2000
2005: Switzerland votes to join the European Schengen Treaty on open borders and extend free movement to 10 new EU Member States
2009: Vote to extend freedom of movement to new EU members, Romania and Bulgaria
2014: Switzerland narrowly supports quotas on EU workers
- European Union
- International trade