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 62% to 38%.
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, put forward by the right-wing Swiss People’s Party (SVP), aimed to scrap a long-standing free-movement deal with the EU and regain full control of the country’s immigration policy.
A similar initiative to introduce quotas on immigrants from the EU to Switzerland narrowly passed in a 2014 referendum, damaging Swiss-EU relations.
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.
A landlocked country that has observed neutrality for centuries, Switzerland has over time veered between seeking closer engagement with the EU, and preferring a more isolationist course.
Swiss people are given a direct say in their own affairs under the country’s system of direct democracy. They are regularly invited to vote on various issues in national or regional referendums.
Under this system, Sunday’s referendum could have forced the Swiss government to unilaterally void its free-movement agreement with the EU by invoking a so-called a guillotine clause.
This clause would have impacted other bilateral deals on transport, research and trade with the EU, disrupting economic activity.
What reaction has there been to the result?
SVP’s president, Marco Chiesa, conceded that his campaign had struggled to garner enough support for the proposal, which was opposed by the government, parliament and unions.
Given that opposition, Mr Chiesa framed the campaign as a “fight between David and Goliath”. “But we will continue to fight for the country and take back control of immigration,” he said.
Opponents of the proposal said the result was an expression of support for open, bilateral relations with the EU. They said voters were worried about the economic cost of ending free movement during the coronavirus pandemic, a time of great uncertainty.
“Citizens were scared,” SVP parliamentarian Celine Amaudruz told public broadcaster RTS.
EU officials, who had been watching the referendum campaign nervously, welcomed the result.
A vote to keep a deal seen as reasonable
Imogen Foulkes, BBC Geneva Correspondent
Swiss voters appear to have said a convincing no to ending free movement of people with the EU.
The People’s Party argued that immigration from Europe was to blame for a rising population, and placed an unsustainable burden on Switzerland’s public services, and environment.
In the past, the party has done well with anti-immigration campaigns, but not this time. The economic consequences were clear.
Some 60% of Swiss exports go to Europe, for example. Moreover, half a million Swiss live and work in the EU, and 1.4 million EU citizens work in Switzerland, many in the health service.
Ending free movement would have put the entire relationship with Europe at risk.
Brussels has always told the Swiss they cannot cherry pick: no free trade without free movement. Today, Swiss voters have shown they think that deal is reasonable.
What other issues did Switzerland vote on?
A referendum on paternity leave for new fathers was among the other issues on Sunday’s ballot.
Projections show the initiative appears to have been backed by a majority, heralding a major change in Switzerland, a country seen as lagging behind its European neighbours on paternity leave.
Fathers should be able to take two weeks of paid leave within six months of the birth of a child. They should be entitled to receive 80% of their salary, up to a ceiling of 196 Swiss francs (£165; $210) per day.
Other issues included referendums on funding for new fighter jets and the revision of Switzerland’s hunting law, which would make it easier to cull 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.
A resounding yes to free movement of people could strengthen Brussels’s hand with London, and be a signal to the UK of just what kinds 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 membership
1992-2002: Switzerland negotiates, then signs first bilateral agreements with EU – they are interdependent, and include free movement of people – backed by a vote in 2000
2005: Swiss vote to join Europe’s Schengen open borders treaty and extend free movement to 10 new EU states
2009: Vote to extend freedom of movement to new EU members Romania and Bulgaria
2014: Swiss narrowly back quotas on EU workers