A teenager who killed a pensioner in his East Ayrshire home after he indecently assaulted her has been ordered to be detained for three years.
Elaine Fleming, 19, admitted the culpable homicide of Harry Smith, 69, in Drongan in October 2009.
The High Court in Edinburgh heard how she repeatedly punched Smith after he touched her while she was asleep.
Lord Kinclaven told Fleming he had shown a degree of leniency because of the circumstances of the case.
The court heard how Mr Smith had taken to drinking following his wife's death and allowed others into his house to drink, among them young people.
Fleming had turned up at his house on the day of the fatal attack and began drinking.
Two schoolgirls later arrived and found her lying in "a drunken stupor" on the sofa next to Mr Smith. They tried to wake her but failed.
The girls said Mr Smith put a hand inside Fleming's trousers and up her top.
After Fleming woke she left the house with one of the girls who told her what had occurred.
She later went back to Mr Smith's home and confronted him shouting and swearing, calling him a paedophile and a pervert and saying he had touched her when she was asleep.
After going in and out of the house several times, Fleming was seen punching Mr Smith to the head.
During the attack he sat on a couch and did not retaliate. Eventually his head slumped to the side and an ambulance was called.
Mr Smith's life support was later switched off at Ayr Hospital after he was found to be unconscious and unresponsive to treatment. Passing sentence, Lord Kinclaven told Fleming: "I am satisfied there is no alternative to a custodial sentence. No other method of dealing with you is appropriate.
"As a result of the assault Mr Smith has lost his life. It is a tragedy for his family and friends."
The judge said he accepted that there were circumstances which could be described as "special characteristics" that allowed him to show a greater degree of leniency in the case.
He said he took into account the background to the fatal assault which involved "an opportunistic, indecent assault" on Fleming by the deceased.
Lord Kinclaven added: "I noted no weapon was involved and there was no gross form of violence used."
He told the teenager that she would have faced a four and a half year sentence of detention in a young offenders' institution but for her guilty plea.