A man launched a "frenzied" knife attack on an off-duty police officer he mistakenly believed to be using "Jedi-like" powers on him, a court has heard.
John McCartney, 40, was seized by a "delusional belief" his victim could "torture him through mind communications".
Basildon Crown Court heard McCartney's fixation led him to stab the other man 10 times.
McCartney admitted attempted murder and was given an indefinite hospital order.
Prosecutor Peter Gair told the court McCartney became obsessed with the victim, who had attended the same school.
They had only ever said "hello" in passing and hardly knew each other, Mr Gair said.
Software engineer McCartney, who has been diagnosed with paranoid schizophrenia, had "delusional beliefs he genuinely believed", he added.
McCartney knocked on the officer's door on the night of 24 April last year, the court heard.
When it was answered, the officer "battled to restrain" McCartney as he launched his "frenzied attack".
The victim suffered stab wounds to his arm, armpit, chin, shoulder, chest, abdomen, stomach and bowel, the court heard.
His wife and neighbours helped to restrain McCartney until help arrived and the officer was taken to hospital for surgery.
Judge Samantha Leigh said that the defendant believed the officer "had the ability to mentally torture him through mind communications" and had described him as "almost Jedi-like".
She added McCartney had sent the officer's email address to extremist groups including Islamic State and hired a private investigator to find his address.
In a statement, the officer said his "physical scars are a constant reminder of that night".
He said he still thought "about lying on the floor once police had taken McCartney away and the feeling of starting to deteriorate".
The officer recalled seeing a colleague writing in her pocket book "to get my dying declaration".
He said he has since returned to work and was "looking forward to the future".
McCartney, of Eastwood Road, Rayleigh, also admitted possessing a bladed weapon.
He was given an an indefinite restraining order forbidding him from ever contacting the officer and his family or going to their address.