NHS staff in Scotland have broken personal data protection legislation hundreds of times in Scotland, ­including a photograph of a patient being posted on Facebook.

An investigation by privacy campaign group Big Brother Watch has revealed the Scottish health service recorded 634 breaches of data protection legislation in three years.

Cases include covert filming of staff, patient case files being left at a bus stop and a patient record being photographed with a mobile phone.

Misuse of social media and inappropriate sharing of patient information were also reported.

The Scottish Ambulance Service records show details of a call-out being posted on Facebook, which resulted in a written warning for the employee concerned. They also reveal a photograph of a patient was loaded on to ­Facebook, resulting in a dismissal.

Of the 634 cases identified between April 2011 and April 2014, 12 resulted in an employee's resignation.

Emma Carr, director of Big Brother Watch, said: "It is clearly unacceptable that health staff in Scotland have thought that they could post such ­confidential details on social media and disclose them to third parties.

"It is completely right that they should be internally disciplined but we question whether that it is enough of a deterrent. Urgent action is therefore needed to ensure that medical records are kept safe and the worst data breaches are taken seriously, including the introduction of greater penalties for those who abuse that access. This should include the threat of jail time and a criminal record."

The campaign group, which was set up in 2009, used Freedom of ­Information legislation to find out details of data protection act breaches within the NHS across the UK.

NHS Borders was among the health authorities that appeared to log the highest number of offences, with 180 in the time frame. This placed the health board at number seven in the table of the UK health authorities with the most data protection breaches. However, its chief executive Calum Campbell said this was because of software it used to scan for possible privacy breaches, and the number of actual breaches was very low.

He said: "NHS Borders has had a total of 180 potential breaches reported through the FairWarning system between 2012 and 2014, with a negligible number requiring disciplinary action.

"FairWarning systematically identifies users who are engaging in patient records access patterns that may be indicative of unauthorised behaviour. The system looks for patterns that might show that another staff member's file is accessed."

A Scottish Ambulance Service spokesman said: "Protecting the privacy of our patients is of paramount importance. There are robust policies and procedures in place for the management of patient data in line with information governance standards and these are reinforced with staff training on an ongoing basis."