A killer who stabbed a walker in a random attack had "lost touch with reality", a court heard.
Moses Christensen, 22, fatally knifed Richard Hall, 70, on Brown Clee Hill in Shropshire in August.
An expert psychiatrist told jurors at Stafford Crown Court the defendant's mental illness was "the only explanation for this killing".
Mr Christensen, who is detained under the Mental Health Act, denies murder by reason of diminished responsibility.
"The whole sequence of events leading up to this were irrational," Dr Dinesh Maganty, a consultant forensic psychiatrist, told the court.
He cited Mr Christensen's desire to be a "lone soldier" in the Royal Marines and plans to kayak around the UK, with no sea-faring experience, as examples.
"His level of detachment from reality was growing," Dr Maganty said. "He had lost touch with reality, there is no doubt about that."
The prosecution allege Mr Christensen, of Corser Street, Stourbridge, West Midlands, understood the nature of his conduct and killed Mr Hall , from Perton in Staffordshire, "because that is exactly what he wanted to do".
Jurors previously heard how the defendant had told police officers he "had planned to kill people".
However his defence, supported by evidence from Dr Maganty, argue his mental disorder would have "very substantially" affected his ability to think rationally.
"In the months leading up to the killing he was increasingly disordered. It is quite clear he was becoming psychotic and acting in a psychotic manner," Dr Maganty told jurors.
"Frankly, other than his mental disorder there is no other rational explanation for what happened.
"If he wasn't mentally disordered there would not have been a death."
The jury must decide if the killing was murder or manslaughter on the grounds of diminished responsibility.
The trial continues.