Moves to introduce a national ID database in Scotland could be subject to a legal challenge, a data privacy group has warned.
On Wednesday, Members of the Scottish Parliament (MSP) voted narrowly in favour of opening up the country's NHS register to hundreds of public bodies, including HMRC.
Critics say the introduction of a "unique citizen reference number" amounts to the introduction of a national database through the backdoor.
Liberal Democrat leader Willie Rennie called the debate to derail the plans, but the majority of MSPs voted in favour of the plans 65 votes to 60.
The Scottish National Party has argued the scheme will be key to underpinning a "digital government". The UK's HMRC also wants access to the NHS database to check that individuals are not avoiding tax.
Jim Killock, executive director of data campaign organisation The Open Rights Group, said the group may mount a legal challenge to the system once the Scottish government has published its consultation response to the plans.
"We will look closely at what the Scottish government says and whether it has taken into account all the evidence put forward," he said.
The Information Commissioner's Office has warned that the introduction of the system is at risk of breaching data protection laws.
In its submission to the consultation the ICO said: "Whilst the ICO are neither for nor against the creation of a national identity number per se, we do advocate against the creeping use of such unique identifiers to the extent that they could become the national identity number by default."
The Open Rights Group has said the process has been created through a weak consultation. It said a “Unique Citizen Reference Number” should be subject to proper legislation.
"The consultation is so bad that the Information Commissioner for Scotland has pointed out that it may be illegal in its current form," said the ORG.
The consultation response is expected to be published in April. ®