Ministers have dropped their plans to create an ID database which critics argued was a precursor to an ID card.

The Scottish Government consulted on proposals in 2015 to share access to the NHS Central Register (NHSCR) with about 120 public bodies, including HM Revenue and Customs (HMRC).

It has now emerged ministers have concluded the move "would not be appropriate", even if it was subject to "strong controls".

The plans were heavily criticised by the SNP administration's opponents at Holyrood two years ago.

Scottish Liberal Democrat justice spokesman Liam McArthur said: "After thousands of signatures, seven rounds of parliamentary questions and two years of Scottish Government prevarication, SNP ministers have finally admitted that they have ditched their dangerous plans.

"Expert after expert warned that a super ID database amplified the risk of misuse and raised the threat of our personal information being searched, profiled and mined.

"Giving every person a unique ID number would have opened the door to ID cards."

In an answer to a written question from SNP MSP Claire Haughey published last month, Finance Secretary Derek Mackay said ministers had "listened carefully to the arguments made during the consultation on proposed amendments to the LEARS (Local Electoral Administration and Registration Services) Act Regulations and have concluded that it would not be appropriate to broaden the range of bodies prescribed in legislation who can share data with the National Health Service Central Register, even subject to strong controls".

"Ministers therefore do not intend to take forward the amendments to this effect originally proposed," he added.

Mr Mackay continued: "Ministers do believe that it is desirable that a member of the public, who wants to access public services online, can be given the chance to demonstrate their identity easily - and be confident that no-one else is able to pretend to be them and that their privacy is guaranteed.

"Ministers therefore intend to work with stakeholders, privacy interests and members of the public to develop a robust, secure and trustworthy mechanism by which an individual member of the public can demonstrate their identity."

The NHSCR is an electronic database held and maintained by National Records of Scotland (NRS).

It holds the basic demographic details of everyone who is born, has died or is, or has been, on the list of a GP in Scotland.

Each individual in the NHSCR is given a unique citizen reference number (UCRN).

At present, it holds address information for approximately 30% of the population, when individuals have consented to their local authority sharing this information with NRS.

NRS also has access to postcode information provided by health boards but it is not currently permitted to hold this information in the NHSCR.

The Government wanted this additional postcode data to be added to the register and shared with other public bodies.

It said the measure would help authenticate the identity of individuals when they use public services, helping to prevent fraud and identity theft.

It would also help identify those who will be eligible to pay the new Scottish rate of income tax, cracking down on tax avoidance and evasion, the Government argued.

A Scottish Government spokesman said: "This was announced to Parliament some weeks ago.

"After listing carefully to arguments made during the consultation period, the decision was taken not to broaden the range of bodies who can share data with the National Health Service Central Register.

"We are working with stakeholder and interested parties to develop a robust and secure way for people to verify their identity when accessing public services online."

Patrick Harvie, the Scottish Greens co-convener, said: "Allowing wider public-sector access to data from the NHS central register sounded like an ID database in all but name. It's good to see the Scottish Government backing down.

"Greens argued that there are better ways of providing medical data without breaching privacy. We look forward to the Government consulting on a new way forward."