A sheriff is to probe how a patient was allowed to walk out of a psychiatric hospital two days before killing his best friend.
David Reid, 47, came to believe Mark Johnston, 53, was the Devil and stabbed him at least 120 times.
Before the killing, Reid had told family members and medical workers about delusions that “demons” were trying to harm him and asked for treatment.
He was admitted to Royal Cornhill Hospital in Aberdeen but doctors said he was not ill enough to be detained for urgent treatment and he left.
Less than 48 hours after being discharged, he phoned his sister to confess he had stabbed Mr Johnston to death in his flat in Broughty Ferry, Dundee, severing his jugular vein with a kitchen knife.
Following the killing, in October 2017, Reid was acquitted of murder after prosecutors accepted he was not criminally responsible for his actions because of a mental disorder.
At the High Court in Glasgow last February, he was sent to the State Hospital at Carstairs without limit of time by Lady Rae.
The judge asked how Reid had been able to leave the psychiatric unit and said she expected the Crown Office to get a report from the local health board and hold an investigation.
It has now been announced a fatal accident inquiry will take place at Dundee Sheriff Court later this year into the circumstances of Mr Johnston’s death.
A preliminary hearing will take place in April.
No date has yet been set for the full hearing to get under way.
Before the fatal attack, Reid told a psychiatric nurse in Dundee he was “receiving messages from God”.
A decision was made to admit him to hospital and two NHS Tayside staff then escorted him in a taxi to Aberdeen, because no psychiatric beds were available locally.
Reid was able to discharge himself shortly after admission after a consultant decided that he did not meet the criteria for compulsory treatment.
He was found covered in blood when he answered the door to police after the stabbing.
Mr Johnston was lying dead in a pool of blood on the living room floor.
Reid told police: “I feel terrible. The Devil told me I had two hours to stab him. I got a knife from the kitchen and sat there.
“He was my only friend. I can’t believe what I’ve done. I stabbed him. What will his family think?”
The court heard that Reid, who suffers from paranoid schizophrenia and bipolar disorder, would present a “serious risk” to the public if at large.