Alexander Lewis-Ranwell, 35, was reportedly suffering from delusions about kidnappings and paedophiles when he killed Anthony Payne, 80, and 84-year-old twins Dick and Roger Carter in Exeter on 10 February 2019, an inquest heard.
Det Sgt Martin Sutcliffe, the deputy senior investigating officer, told jurors at Exeter County Hall that Lewis-Ranwell later stated he was experiencing delusions about "people being either trapped, kidnapped or held against their will" and felt a compulsion to assist.
Lewis-Ranwell had been released from custody hours before the killings, still wearing the grey tracksuit issued to him after an earlier arrest. He had been detained and released twice in the two days prior to the attacks.
The inquest heard that Lewis-Ranwell had been detained under the Mental Health Act on two separate occasions in 2016 and 2017. Officers attending an incident involving Lewis-Ranwell at the Castle Inn in Combe Martin on 8 February 2019 reportedly commented on his mental state, with one saying, "He's not right, is he?"
He was released on bail from Barnstaple Police Station shortly before 03:00 on 9 February. Less than seven hours later, he was arrested again after allegedly attacking farmer John Ellis with a saw and a "large stick". Lewis-Ranwell was released for a second time due to custody time limits on 10 February, before travelling to Exeter and committing the killings.
CCTV footage showed Lewis-Ranwell entering Mr Payne's home and leaving approximately six minutes later. Mr Payne was found dead with head injuries, believed to have been caused by a rusty hammer. The Carter brothers also sustained head injuries, which police believe were caused by a spade found in their house.
The inquest continues.