Swiss voters have rejected a proposal to end an agreement the European Union concerning the free movement of people, with the final result of 61.7% against and 38.3% in favour.
Earlier, the Swiss broadcaster SRF said that voters were set to reject the plan by 63% to 37%.
Although the country is not an EU member state it currently accepts free movement so that it can have access to free trade and co-operate with Brussels in areas like transport and education.
Those supporting the anti-free movement plan argued that by ending the freedom of movement of people, Switzerland would control its borders and select only the immigrnts it wants.
Opponents have maintained that if such a proposal goes through, the healthy economy would plunge into a recession while hundreds of thousands of Swiss citizens would be deprived of their freedom to live and work across the bloc.
Swiss have voted on a number of other issues including paternity leave for new fathers which seems to have been backed by the voters, while they rejected a proposal to make it easier to hunt protected species such as wolves.