Nigel Farmer was assessed as a "low to moderate" risk by psychiatrists just weeks before he went "berserk" in the frenzied knife murder.
The father-of-two had checked into a psychiatric unit after telling his mother he was "scared of what he might do" to himself and others.
He had already cut his wrists and told the Old Bailey he had "never felt so low" after being thrown out by his partner who had started seeing another man.
Farmer, a drug addict with a previous conviction for a knifepoint robbery, had threatened to break her neck when he found out about the relationship.
After being admitted to hospital on 25 May last year he was hitting walls with his head and his fist, once breaking his hand, and shouting and screaming.
But four days later he walked out of the Oxleas unit in Woolwich, south east London, claiming he was not getting the treatment he needed.
A month later on 29 June he took part in the "orgy of bloodletting" that resulted in the deaths of Laurent Bonomo and Gabriel Ferez.
In the midst of the violence, he found time to ring friend Bernie Sonnex - brother of co-defendant Dano - to boast of the crime.
Bernie's girlfriend Fay Culyer overheard him shouting to one of the victims: "Shut your f****** mouth or I'll cut your hand off."
Farmer, a 34-year-old father of two, was spending £100 a day on heroin and crack cocaine and may have killed to feed his drug habit, the Old Bailey heard.
Hours later he doused the students' flat with petrol and torched it to cover up evidence, and was badly burnt in the ensuing fireball.
He would later tell Miss Culyer that one of the students - thought to be Laurent Bonomo, stabbed 194 times - "just wouldn't die".
Farmer denied a claim by Crispin Aylett QC, prosecuting, that he and Sonnex "simply went berserk".
On 7 July he handed himself in at Lewisham police station after an e-fit made with the help of a man who saw him flee from the fire was widely publicised.
But Stephen Keen, the receptionist at the station, thought it could be a hoax and that the colour of his face, said by another witness to be "red raw" was an "alcoholic flush", and told him to wait.
Farmer complained loudly: "I just killed two f****** people and the police don't f****** want to do anything about it."
Terrified witnesses said he was "wired", telling them he had third-degree burns. His faced looked flaky and his hands were red and he was rubbing cream into them.
Farmer, who drank heavily as well as taking drugs, had recently plunged into depression after splitting up from his partner of ten years, the mother of his twin sons, now aged eight.
While in custody he rang his mother to call her a "grass" after she gave a statement to police about him and said his QC would "destroy" her in court.
Dublin-born Farmer, one of four brothers and two sisters, told the court how he left home at 15 after rows with his "disciplinarian" stepfather and began working in the "glass industry".
In March 1997 he was jailed for three years after he and a friend robbed a stranger at knifepoint the previous June. He was released in April 1998.
The following year he met a new partner who he was to live with for the next ten years. She cannot be named for legal reasons. The couple had twin sons in September 2000.
He began working as a decorator, with jobs at the ITN headquarters and the ICI building as well as Liberty's and Gap in central London.
Farmer said he developed a drink problem after troubles at home, would sometimes get involved in pub fights, and once smashed up the kitchen, but he had never hurt his partner or their children.
Their relationship finally broke down after she started working in Tesco and met someone else and when she finally threw him out at the beginning of May last year he began taking increasing amounts of drugs.
"I'd never felt so low in my life, I couldn't see my kids or anything. I felt I couldn't cope," said Farmer.
He began hanging around with a group led by Bernie Sonnex, the older brother of co-defendant Dano Sonnex, who was said to have had a fearsome criminal reputation and a string of previous convictions.
Farmer would later deny that he carried out the murders because he wanted to prove to Bernie that he was not a "wally" and could commit "major league crime".
His mother took him to the Queen Elizabeth Hospital in Woolwich, south east London, where he was admitted to the Avery Ward of the Oxleas psychiatric unit.
She later said she was "torn apart" by the murder allegations against her son.
A medical report on Farmer from the hospital said: "He has had occasions when he has been banging his head against the wall.
"Two days ago he felt that he couldn't cope and punched a wall with his right hand which is now fractured and swollen."
On another occasion a member of staff wrote: "Nigel appeared tense and suddenly started shouting and screaming at staff. Around 2am he was observed banging his head on the wall due to tension."
There was also a "period of screaming and shouting"
Following a meeting it was decided his risk of harm to others of being discharged was "low to moderate".
Farmer admitted in court that he set fire to the flat but claimed he had been forced to do it after threats were made to his children and that he had nothing to do with the burglary and murder.
Prosecutor Crispin Aylett QC said the "sadistic ferocity" of the attack appeared to suggest that "those responsible can only have been psychopaths" but there is no evidence that either defendant suffered "any significant mental illness".Reuse content