A teenager has been locked up for 12 years for the "brutal and senseless" killing of a barman who a judge said had shown him nothing but kindness.
Ryan Esquierdo, 19, assaulted and killed Stuart Walker "in a most horrific way" on October 22 last year, and then set his body on fire.
The 28-year-old's body was discovered at an industrial estate in Cumnock, Ayrshire.
Esquierdo was initially charged with murder but pleaded guilty just before his trial to the reduced charge of culpable homicide on the grounds of diminished responsibility.
Temporary Judge Rita Rae QC gave Esquierdo an extended sentence, involving detention for 12 years and supervision for a further five years following his release from custody. She was told he has been assessed as posing a high risk of re-offending and a very high risk of serious harm to the public.
Passing sentence at the High Court in Glasgow, the judge told Esquierdo: "You have pleaded guilty to a brutal and senseless killing of a decent young man who appears to have attempted to show you only kindness and sympathy and for that he lost his life in a most horrific way."
The barman tried to speak to Esquierdo about his confused sexuality but the teenager later turned on him. The judge said the victim displayed no aggression towards the killer before the attack.
The judge said: "I cannot ignore too that, although having no memory of what you had just done, you had the presence of mind to attempt to cover up your crime and to destroy evidence. That included setting fire to Mr Walker's body and making up a story for the police that you had been attacked by others and that they had killed Mr Walker. You kept up that pretence for some considerable time."
After the killing, which sent shockwaves through the local community, thousands of tributes were left on online pages set up to honour the former Royal Hotel worker. The case was even raised at Prime Minister's Questions in the Commons and at First Minister's Questions in the Scottish Parliament.
Temporary Judge Rae said no sentence can compensate Mr Walker's family and friends for their loss. In passing sentence, she took into account the killer's age, lack of previous convictions, his expressions of remorse and the fact that he admitted his guilt before the trial started. It was backdated to October 31 last year.