Judge Grant Fraser accepted a report from a forensic court liaison nurse, who also made a presentation in court, that the man was unwell and required 24-hour care from experienced mental health workers.
Dr Jeremy Skipworth, the clinical director of the Mason Clinic, formally supported the report's recommendations, based on the man's current health presentation and medical history.
The judge accepted that while mental health care was available in prison, it was not on the necessary 24-hour basis.
Earlier today, police named the 36-year-old man who was found dead at his Auckland home yesterday.
He was Dean Andrew Clark.