A formal review is being carried out at a health board after the email addresses of almost 40 people living with HIV were accidentally made public.
In an email sent by NHS Highland, the addresses of 37 patients were visible along with an invitation to a support group run by a sexual health clinic at Raigmore Hospital in Inverness.
Each of the patients who received the email have now been contacted by the board.
In a statement, the board said: “NHS Highland deeply regrets that this breach of confidentiality has happened and we have contacted patients individually to apologise.
“As per normal procedure, a formal internal review is being conducted to understand how this has happened and to consider any steps to avoid this happening in future.”
Nathan Sparling, chief executive of HIV Scotland, said the breach would have caused people distress.
“This kind of leak is unacceptable and it is only right that NHS Highland have reached out to those affected and apologised,” he said.
“Confidentiality is of paramount importance when it comes to people living with HIV, and the decision to disclose their status should be theirs and theirs alone.
“People affected by this leak will be understandably distressed and HIV Scotland stands ready to support all those affected.”
He added: “I am pleased that NHS Highland have instigated a swift investigation.
“There must be strict safeguards put in place to ensure that this sort of thing never happens again.”
Scottish Green MSP John Finnie said: “It’s extremely disappointing that confidentiality has been breached in this manner.
“This will have undoubtedly caused upset to the patients concerned. I’m glad NHS Highland has launched a swift review into this matter, they must ensure that steps are taken to ensure such a breach cannot happen again.”