In April, police took him to Auckland Hospital, concerned for his health, but while they spoke to doctors he set fire to items in the observation room where he was being held.
He was charged with arson and intentional damage as well as assault after he spat at a doctor.
Despite an acknowledgment that the offending was at the lower end of the scale, Crown prosecutor Kate Eastwood said it marked an escalating pattern of behaviour.
Judge Thorburn put it down to one catalyst.
"Alcohol. All the time, every time," he said.
He was scathing of the behaviour that landed O'Loughlin before the court, describing the arson as "incredibly stupid, spontaneous and reactionary".
"His conduct in the face of people trying to help him was appalling. There was no rationality to it whatsoever."
But a psychologist's report provided to the court described a tragic upbringing and a host of issues derived from it.
"This is a young man who has an unenviable disadvantage in the way his life unfolded and added to that are some quite evident, professionally-diagnosed conditions that he has to walk through life with," the judge said.
Sentencing O'Loughlin to jail was not going to address any of his underlying problems, Judge Thorburn said, but it was his only choice.
At least it was a "forced detox period", he said.
O'Loughlin was jailed for 10 months and ordered to serve six months of post-release conditions, which would likely involve him attending counselling for alcohol abuse and anger management.