Left-wing groups warned that the law would violate citizens' privacy and undermine Switzerland's neutrality as the secret service would also be allowed to cooperate with foreign intelligence agencies.

But the government insisted it was not aiming to set up a vast data-gathering apparatus, similar to the one developed by the US National Security Agency (NSA) that came into the public eye in part through former contractor Edward Snowden's revelations.

"This is not generalised surveillance," said Yannick Buttet, a politician and Christian Democratic Party vice president. "It's letting the intelligence services do their job."

Guy Parmelin, Swiss defence minister, said that with the new measures Switzerland was "leaving the basement and coming up to the ground floor by international standards".

Parmelin insisted that the Swiss system was not comparable "to the United States or other major powers", which have struggled to find the right balance between privacy and security.

'Disproportionate'

Rights group Amnesty International said it regretted Sunday's result, arguing the new law will allow "disproportionate" levels of surveillance, adding it posed "a threat ... to freedom of expression".

The new bill, which will only be triggered with approval by a federal court, is due to go into force on September 1 next year.

The law was approved by parliament in 2015, but an alliance of opponents - including from the Socialist and Green parties - got enough signatures to force Sunday's referendum.

The poll was part of Switzerland's direct democracy system, in which votes are held on a wide range of national issues four times a year, and even more frequently at regional and municipal levels.