A "predatory and dangerous" teenager who tried to rape an elderly woman at a nursing home has been detained.
Josh Howarth, 19, admitted the attack at New Thursby Nursing Home in Lytham St Annes, Lancashire, on 4 August.
He was arrested after being disturbed by a staff member and fleeing through a window. The victim has since died.
A judge at Preston Crown Court sentenced Howarth, of Gibson Avenue, St Annes, to six years and nine months at a young offenders institute.
He must also serve a further three years and three months on licence and has been placed on the sex offenders register.
The victim died in October but her death was unrelated to the attack, police said.
Det Insp Jamie Lillystone, Lancashire Police, said: "This was a sickening attack on a vulnerable elderly lady at a place where she should have felt safe.
"Howarth went to great lengths to break into her bedroom and had intentions of carrying out the most despicable crime.
"The only consolation is that he was disturbed by a member of staff, but nonetheless this was an extremely traumatic experience."
Howarth's actions were "predatory and dangerous", the detective continued, and said he hoped the sentence would help bring the family "some peace and closure".