Miles Hughes, 18, from Camden, allegedly used a Stanley knife to carve his name in his victim’s arm before launching the terrifying attack.

Hughes, of Dynam Road, told his crying victim that voices in his head were ordering him to kill her before plunging the blade into her neck and chest on July 9 last year, it is claimed.

But a member of the public put an end to her ordeal and the girl was able to escape, jurors heard.

The court heard Hughes told a pal he was happy he had done it and had enjoyed seeing her begging on her knees.

Hughes claimed they had agreed to meet at West Hampstead graveyard to self-harm before having consensual sex and insisted he had not intended to kill her.

He has admitted wounding with intent to cause grievous bodily harm, but is standing trial at the Old Bailey charged with rape and attempted murder.

Prosecutor Jane Osborne said: “He stabbed her multiple times in the neck and chest. It was more by luck than judgement, that Miles Hughes didn’t kill her.”

Jurors heard Hughes began cutting his own arm with the Stanley knife, while the 15-year-old pulled out a razor blade she had concealed in her mobile phone case.

After he had scratched the word “Miles”, he asked his alleged victim for sex and she again said “no”, jurors heard.

Ms Osborne said: “This time, however, the defendant didn’t take no for an answer.”

He then allegedly pulled his trousers down, grabbed her neck and raped her, it is claimed.

Hughes returned home and dialled 999, telling them he had killed a girl by stabbing her in the throat.

He later went on to tell police they had had consensual sex and his alleged victim had asked him to “make her scream”.

Hughes, of Dynham Road, Camden, northwest London, admits wounding with intent, but denies attempted murder and rape.

The trial continues.