Swiss voters have rejected in a referendum a proposal to end an accord with the EU on the free movement of people, TV projections suggest.
Broadcaster SRF said voters were set to reject the plan by 63% to 37%.
Ballots are still being counted, and final results are due within hours.
Switzerland is not a member of the EU, but currently accepts free movement so that it can have access to free trade and co-operate with Brussels in areas like transport and education.
The proposal came from the right-wing Swiss People's Party (SVP), and was a successor to a 2014 referendum to introduce quotas on immigrants from the EU, which narrowly passed.
Supporters of the anti-free movement plan said it would allow Switzerland to control its borders and select only the immigrants it wants.
Opponents argued it 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 have also been voting on a number of other issues.
They appear to have backed 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 being prepared before the UK voted to leave the EU in 2016.
The SVP has used similar arguments to Brexiteers about having more control over immigration in a country which they say is becoming more overcrowded and expensive as a result.
But net migration into Switzerland is actually falling at the moment, and there is a sense voters are becoming weary of the party's anti-immigration message.
The BBC's Imogen Foulkes in Geneva says a resounding yes to free movement of people might well strengthen Brussels' hand with London, and be a signal to the UK of just what kind of compromises might be needed to agree a free-trade deal with the EU.
Timeline: Switzerland and the EU
1992: Swiss vote by 50.3% to 49.7% against joining European Economic Area – first step towards EU membersRead More – Source