The man was charged with attempted sexual violation by rape, sexual violation by unlawful sexual connection, and dealing with a girl for the purpose of sexual exploitation.

In July 2015 the court deemed him to be mentally impaired and unfit to stand trial.

The man denied the crimes and his medical assessors considered he was at “some risk of reoffending” if circumstances arose that gave him the opportunity to do so.

However they also acknowledged that the man’s age, and the very specific set of circumstances that lead to the offending, meant he was a low risk.

Between 2009 and 2014 the man lived next door to a woman, who was also later declared by the court to be unfit for trial.

The woman’s daughter, aged between 9 and 14, was routinely visited by the defendant who gave her and her mother cigarettes and money.

In return he ordered the girl into a room and made her remove her clothes before sexually abusing her.

The girl’s mother encouraged the girl’s compliance, saying the man would stop giving them money otherwise.

The fact that the man’s offending was “deliberate and planned” as opposed to “impulsive”, and required the assistance of a co-offender, meant it was “highly unlikely” the situation would happen again in the future if adequately supervised, a psychiatrist told the court.

Under the act, having been deemed culpable of the crimes, the High Court had the power to order the man into care at the Mason Clinic or a hospital, or be released into the care of family.

“The difficulty in the present case is that all of the options provided…have draw backs,” Justice Lang said in his decision.

The man was not that seriously ill that he needed to be a patient at the Mason Clinic, but making him a patient under a compulsory care section of the Intellectual Disability Act was also pointless because experts said he had a lack of rehabilitation potential.

The only remaining alternative was being released immediately, an avenue that was opposed by the Crown because the Act didn’t provide that the man could be monitored by way of release or bail conditions.

“I consider this to be a serious shortcoming in the statutory regime because it effectively prevents the court from having any oversight in respect of a defendant’s future activities notwithstanding the fact that criminal charges remain in existence,” Justice Lang’s judgment said.

He called it a “deficiency” which could easily be remedied by amending the act to include release conditions.

“This would enable the court to impose conditions designed to cater for the possibility that release back into the community may not prove to be a satisfactory outcome.”

It was “technically feasible” to impose bail conditions because the charges still existed, but he considered it an “artificial” use of the court’s power.

Justice Lang said it wasn’t the only case where the issue had been encountered.

“The problem needs to be addressed as a matter of urgency.”

He ordered his judgment be sent to the Ministry of Justice’s policy division, responsible for considering amendments to the act.

Justice Lang ordered the man into the care of his son and daughter-in-law, who had four children and another on the way.

The couple had looked after their father during his time on bail and the man had occasionally visited a rest home whose staff managed patients with mental impairment.

He was strictly supervised to ensure his separation from young people, according to the judgment.

“His son and his wife firmly believe they have the ability to minimise the risk of future offending by constantly supervising (him) notwithstanding the fact that they will also be shortly looking after five young children,” Justice Lang said.

The man would also be visited by the Intellectual Disability Offender Liaison Service.

In 2016 the girl’s mother was ordered to undergo supervised care and rehabilitation for her part in the offending.