A new national policy on the use of CPR on terminally-ill patients is expected to be published in September.

Health Secretary Shona Robison said the review and update of policy is part of efforts to "ensure that palliative and end-of-life care is delivered to a high standard, in every situation, right around the country".

Scotland became the first country in Europe to put in place a national policy for CPR decision-making and communication in the NHS in 2010.

A recent legal ruling and changes in UK-wide good practice guidance mean this has been reviewed.

The update emphasises the importance of engaging with patients and their families about when resuscitation can be used for those nearing the end of life.

Ms Robison said: "Whether or not to attempt CPR towards the end of someone's life is one of the most emotive and sensitive decisions that patients, doctors and relatives will ever have to face.

"There are occasions when CPR is attempted inappropriately against the patient's wishes or when the patient is in the very final stages of their illness and it is clear that CPR will not work.

"That can be distressing for everyone involved, and it's why it's so important that a conversation takes place.

"Proper training for clinical staff is vital and we're working to ensure that this is in place.

"What is important is that treatment options are discussed honestly and that the patient's wishes are taken into account where possible."