Swiss voters have narrowly approved a plan to introduce voluntary electronic identity cards.

With all votes counted, 50.4% of those who voted said yes to the proposal, while 49.6% rejected it.

The closeness of the ballot is a surprise. Opinion polls had suggested up to 60% backed digital IDs, which also had the approval of the Swiss government, and both houses of parliament.

It was Switzerland's second vote on digital IDs. An earlier proposal was rejected in 2021, amid concerns the data would be held centrally, and controlled largely by private providers.

Sunday's revised proposal keeps the system in government hands. Data will be stored only on the smartphones of individual users, and digital IDs will be optional.

Citizens can continue to use a national identity card if they choose, which has been standard for decades in Switzerland.

To further ease privacy concerns, a particular authority seeking information on a person – such as proof of age or nationality, for example – will only be able to check for those specific details.

This development comes after the UK government announced plans to introduce its own digital ID, which would be mandatory for employment, as part of efforts to curb illegal migration.

The proposed British digital ID would have fewer intended uses than the Swiss version, but it has raised similar concerns about privacy and data security.

Supporters of the Swiss system say it will make life much easier for everyone, allowing a range of bureaucratic procedures – from getting a telephone contract to proving age for alcohol purchases – to happen quickly online.

Opponents of digital ID cards, who gathered enough signatures to force a referendum, argue that the measure could still undermine individual privacy.

They express fears that, despite the new restrictions on data collection and storage, it could still facilitate tracking individuals and be exploited for marketing purposes.

Switzerland has a longstanding commitment to protecting citizens' privacy, evident in its banking secrecy laws and strict data governance. For years, even Google Street View faced backlash in Switzerland, leading to requirements for automatic blurring of sensitive locations.