PLANS to open up an NHS ID database to more than 100 public bodies have been narrowly backed by MSPs, despite claims that ministers had ignored their own privacy guidelines when drawing up the proposals.

The SNP used its numbers at Holyrood to amend a Liberal Democrat motion which called for the Scottish Government rule changes, which it was warned will serve as a stepping stone to compulsory ID cards, to be introduced through primary legislation and therefore subjected to greater scrutiny.

Nationalist backbenchers uniformly rejected calls from Liberal Democrat leader Willie Rennie to rebel against their party leadership by backing his stance, instead supporting a government amendment put forward by Deputy First Minister John Swinney.

In a hot-tempered exchange, Mr Swinney accused Mr Rennie of misleading the public over his plans, saying he was guilty of spreading "absolute shameful total nonsense" and "scaremongering".

The Government has said allowing other public bodies, including the HMRC, access to the database will help prevent online identity fraud and help build up an accurate picture of Scottish taxpayers, ahead of the devolution of income tax.

Opponents say that the widespread use of the database, and the use of the a unique identifying number for every citizen, raise issues over civil liberties, privacy and increase the likelihood of personal data being stolen.

A Scottish Government document, published in October, states that sharing "persistent identifiers" between public bodies should be avoided, which opponents claim is now being proposed by ministers.

Mr Rennie said: "Yes, we do have a unique number at present but it is not unique across the public sector. To allow all organisations to share that number means we move from having a series of numbers to one, single, universal number. It leaves open the possibility that information can be searched, profiled and mined.

"If there is an all-encompassing single database with one single number for each individual, with no consent required, then it is simple to produce a card with that number and stick a picture on it too. I think everyone would recognise that as an ID card. We may not be there yet but we are creeping towards that destination."

Despite all opposition party MSPs and two of three independents voting against Mr Swinney, his motion passed by five votes. Independent Jean Urquhart first voted against the government amendment before backing it at the second opportunity.

Children's minister Aileen Campbell made a surprise appearance for the vote, returning temporarily from maternity leave. An SNP spokesman denied that she had been recalled as party whips were worried about a rebellion, claiming that the Clydesdale MSP travelled to Parliament with her baby boy to attend a meeting and visit a small stall promoting the town of Lanark.

The motion that passed states that ministers will to report back to the Parliament on responses to a consultation before outlining further steps. Mr Swinney confirmed that a Privacy Impact Assessment would be carried out and suggested that the list of bodies able to access the database may be reduced.

Tory deputy leader Jackson Carlaw said the Deputy First Minister was "scrambling up ice without a pick". He also criticised SNP backbenchers, singling out Christine Grahame who he said would be "throwing her jewellery at the ministers" if any other Government had proposed opening up the NHS database.

He said: "The SNP don't appreciate the irony, because after eight years in Government they are doing what during all the years in opposition they used to rail against."