A man who stabbed a pregnant woman to death with a screwdriver has been detained under the Mental Health Act.
Ella Parker, 29, was found dead in her Milton Keynes home in December. She had been stabbed 33 times.
Ryan Blacknell, 25, pleaded guilty to manslaughter after previously denying a murder charge. The court heard he had been suffering from schizophrenia.
Judge Richard Foster told Luton Crown Court the "tragic" case "might have been avoidable".
Days before the killing, Blacknell's mother had become concerned about his behaviour and called police who took him to a mental health unit at the Campbell Centre in Milton Keynes.
He stayed there as an informal patient but left after one night.
Defending, Mr Andel Singh said: "He left the Campbell Centre because he felt the in-patients were going to eat him if he stayed another night."
Blacknell, of no fixed abode, was a childhood friend of Ms Parker's brother and went to stay at their house in New Bradwell.
The court heard how on the morning of 7 December Ms Parker, who was five months pregnant with her first child, had been painting her kitchen ceiling and sent a selfie to a friend saying "more paint on me than the ceiling".
Hours later her body was found in the hallway by a neighbour who had come to help with the renovations.
A post-mortem examination found 33 puncture wounds, some as deep as 8cm (3.15in), on her neck and head.
The court heard that after stabbing Ms Parker to death and leaving her in a pool of blood, Blacknell went to a local pub and had a pint of lager.
Ms Parker's cousin Peta Ferguson said Ella was "really excited" about becoming a mum and had been preparing her home for the baby's arrival.
In a statement, relative Vivienne Parker said: "Unfortunately her kind nature appeared to be her downfall as unbeknown to her she had taken her killer in to her home.
"This horrific crime has given us pain every day. We can't help think whether it could have been prevented."
Judge Foster said: "I hope at the very least there will be... a full investigation in to the decisions by the Campbell Centre in not taking further steps to ensure this sick man was not a danger to the public, as clearly he was."
He said he made the hospital order, with a restriction order, to protect the public.
A spokesman for Central and North West London NHS Foundation Trust, which runs the Campbell Centre, said: "A full internal investigation is under way by a panel of impartial senior and experienced clinicians.
"They will review the case and make recommendations about future care and service delivery."