A husband who was jailed after killing his terminally ill wife in "a final act of love" has been freed after appeal judges quashed his sentence.

Ian Gordon, 67, was imprisoned for 40 months last year after admitting smothering his spouse Patricia, 63, with a pillow at their home in Troon, Ayrshire.

But Lord Brodie, sitting with Lord Turnbull, overturned the decision on Thursday and admonished him for the culpable homicide of his wife.

Gordon's defence counsel, the Dean of Faculty Gordon Jackson QC, told the Criminal Appeal Court in Edinburgh: "In the particular circumstances of this case there was neither public nor private interest in the sentence of imprisonment."

Lord Brodie said: "The taking of human life is always a matter of the utmost seriousness.

"However, having read all the material which was provided and having listened to what was said by the Dean of Faculty we agree this is indeed an exceptional case."

The judge said it was accepted by the authorities and Gordon's family that his actions in hastening the death of his wife were motivated "solely by love" for her.

Lord Brodie said Gordon was devoted to his wife of 43 years.

The court was told that Mrs Gordon, who was suffering from terminal cancer, was in terrible pain and that painkillers were not working.

Mr Jackson said that in addition she had an intense fear of medical intervention and all she wanted was for her husband to try to care for her.

Mr Jackson said the Sunday before she died she was admitted as an emergency to hospital, but only stayed a day and a half.

The defence counsel added: "She could not stand being there any longer."

He said: "She was getting painkillers but eventually they did not work very well anymore,"

A daughter had described her mother as screaming and moaning and clearly in excruciating pain.

Mr Jackson said that as the pain became more excruciating "Mr Gordon did what he did".

"He says he could tell just looking at his wife and she was looking at him that that was what she wanted at that stage.

"There was no struggle, no fighting. He simply placed the pillow and let her go."

Mr Jackson said their daughter Gail had described them as a couple who were absolutely devoted to one another after meeting as teenagers.

He said: "As she put it 'for dad everything was about mum'.

"She had told how she became aware of her mother's fear of hospital and that she did not want to be left alone to die in hospital.

The defence counsel said that a family doctor had described what Gordon had done as "his final act of love".

Mr Jackson said that jailing Gordon took him away from his family and meant he was not with them to help with the grieving process.

He added: "They feel as if they have been given a double whammy."

The defence counsel said: "There is absolutely no reason why this man should be in jail and certainly not for any longer."

Gordon originally stood trial at the High Court in Glasgow on September 6 last year charged with murdering his wife on April 28 in 2016, but two days later the Crown accepted his plea to the reduced charge of culpable homicide on the basis of diminished responsibility.

He had previously offered to plead guilty to that offence.

The sentencing judge, Lord Arthurson, told Gordon that given the nature of the charge he was convicted of, a custodial sentence was "inevitable".

Lord Brodie said that in a case of murder only one sentence is available to the court, a life sentence, but where it is culpable homicide the court has a wide discretion in considering sentence.

The appeal judge said they would give full reasons in writing for their decision at a later date.