A man was stabbed to death as he lay asleep in bed by an intruder who then woke the victim's girlfriend by biting her on the cheek, a court has heard.
Ben Harvey, 22, is accused of then driving to a nearby village and gaining access to a cottage, where he attempted to remove the pyjama shorts of a teenage girl as she slept in bed.
Harvey, of Ridges View, Little London, near Andover, Hampshire, is on trial at Winchester Crown Court accused of the murder of William Rudiak, 26, and assault causing actual bodily harm to the victim's girlfriend, Alexandra Taylor.
He also faces a third charge of trespass with intent to commit a sexual offence.
Kerry Maylin, prosecuting, said that Harvey entered the house in Turin Court, Andover, at 2.57am on June 11 last year and was in the property for just over 10 minutes.
She said: "He broke in armed with a large kitchen knife and whilst there, having entered by an open window, fatally stabbed William Rudiak.
"William Rudiak, in that early hour of the morning, was fast asleep. He lay in bed next to his girlfriend, Alexandra Taylor, and it was during the course of him being fatally stabbed that Alexandra Taylor woke up.
"She woke up not because William had been stabbed but because she felt someone biting her on the cheek."
Ms Maylin said that Ms Taylor had carried out resuscitation in a bid to save her boyfriend's life with the instructions of a 999 call handler, and added that the knife was found in the bedroom.
The prosecutor said that following the attack, the defendant had then driven to a local village where he had gained access to a cottage and attacked the teenage girl in her bed about an hour later and "smothered her face with his hand".
Ms Maylin said that the victim "said to her mother, 'A man has been in my room trying to get my clothes off'.
"She had on that hot June night a small pair of pyjama shorts and vest-type crop top."
Ms Maylin said that the movements of Harvey's silver Volkswagen Polo had been tracked by an insurance black box installed in his car.
She added that his father, Raymond Harvey, contacted police later that morning and told them that "his son might have killed someone".
She added that he had also told officers that his son had a drugs problem with cocaine and cannabis dating back three years.
Ms Maylin said that the defendant had visited the area of Turin Court three times in the days before the fatal attack, looking for drugs, although the prosecutor said that the occupants had not been involved in supplying drugs to him.
The family of Mr Rudiak, who lived in Chandler's Ford, said in a statement after his death: "He was a wonderful son and brother who had so much to give to the world.
"He has left a huge hole in our hearts and will be dearly missed by us all."
The defendant denies the charges and the trial continues.