A woman who fatally stabbed her friend in May has been found not guilty by reason of insanity.
Heidi Pryor died on 6 May this year after she was attacked at an address in the Wellington suburb of Strathmore Park.
Justice Simon France said when the woman stabbed Ms Pryor she acted under the delusional belief that a "higher power" had told her Ms Pryor's death would save the world.
He said at that time the woman's mind was very disturbed by the mental illness that had her in its grip.
Justice France ordered the woman be detained as a special patient in a mental health facility, which he said would minimise the risk of such an incident happening again.
The High Court in Wellington was earlier told the women met because their partners had a long-standing friendship.
Ms Pryor was due to pick up her husband from Wellington Airport later on the night she died, but her friend invited her to come to dinner before going there.
Ms Pryor became very concerned about the woman's strange behaviour, which included placing a beanbag near a chair, standing on the chair and falling backwards onto the bag.
However, when Ms Pryor said she was going to call the woman's parents for help, the woman stabbed her numerous times.
Justice France said that included two blows to Ms Pryor's chest, which severed vital veins and arteries, causing her to collapse and die almost immediately.
He said the woman had suffered an earlier psychotic episode in 2015 and earlier this year her mental health deteriorated again and she became fixated on an imaginary friendship.
He said she believed that person was communicating with her via music playlists posted on social media.
The judge said, up to Ms Pryor's death, the delusions were getting worse but neither she nor those around her were aware of that.
"There is no doubt that on the day of the stabbing she was suffering from significant delusions. She believed she was receiving instructions from a higher power that she needed to act to save the earth."
Justice France said the woman believed she had been told Ms Pryor was a martyr whose death would save the world.
He hastened to add he was not saying that someone who believed in guardian angels was insane.
"Many people believe in such things [but] it is the linking of the disease of the mind [which] makes it insanity."
Fit to plead but insane at time of killing - psychiatrists
Two psychiatrists gave evidence at today's hearing that the woman was fit to plead to the murder charge, but would have been insane at the time of the killing.
Professor Philip Brinded said, while the woman had done well since the killing, that did not detract from the fact she was severely mentally ill and had no insight that her health had deteriorated rapidly.
"She came off her medications and the result was a catastrophe, so my advice to the court would be [to make her] a special patient so that all those extra safety net issues are in place."
Dr Justin Barry-Walsh also recommended the woman be held as a special patient, saying that was both in her interest and the public's.
"The concern is the potential harm that would occur... if she was under a less restrictive regime and fell out of treatment or relapsed as a result of that and the harm that might arise from that."
Based on their assessments, Justice France made that order, saying it also allowed much greater control when and if she was returned to the community.
"Those responsible for her care and for the decision to release her are empowered to impose much greater oversight and monitoring conditions."
At the end of the hearing, Justice France expressed sympathy to both families involved.
The woman has been granted continued name suppression for two weeks, in case she wanted to appeal against the discontinuation of suppression.