Whanganui District Council has lost its legal bid to prevent the serial sex offender Stewart Murray Wilson being released from jail to live in the local prison grounds.
Wilson, 65, was transferred to Whanganui Prison on Saturday, ahead of his release this week into a house outside the prison fence.
At Monday's judicial review hearing in the High Court at Wellington, the council's lawyer said the Department of Corrections' decision was flawed as its primary focus was keeping Wilson away from victims.
Justice Young did not agree, dismissing the council's case.
Whanganui Mayor Annette Main said she was frustrated and disappointed at the dismissal.
She said the council plans to hold an extraordinary meeting on Tuesday.
But she said the council has very few options left, other than looking at the plan Police and Corrections have developed to keep the community safe.
Ms Main says the Government needs to pass legislation preventing a similar situation facing other communities in future.
The mayor said Corrections will now have to work harder than ever to convince the Whanganui community to trust it over Wilson's release.
She said winning trust will be difficult because Wilson's move to the area at the weekend was a surprise.
The prison is abut 11km southeast of Whanganui city.
Wilson's bid also dismissed
Justice Young also dismissed most of Wilson's challenge to the Parole Board and Corrections Department handling of his release.
He did uphold Wilson's challenge to his reintegration plan, including the requirement that he only leave his home accompanied by two minders.
A special Parole Board hearing will take place on Tuesday to further consider that matter.
Wilson's lawyer Andrew McKenzie says the hearing was a partial success for his client.
The court kept most of the restrictions against Wilson in place, ruling only against the requirement for him to have two minders when he left his home.
However, Mr McKenzie says the judge made comments about other restrictions that will strengthen his client's position when he has to negotiate with his probation officer about what he can and cannot do.
He says there were "some helpful steers" from the judge, for example, it would be very difficult to see how a probation officer could prevent Wilson attending church providing he was attending it genuinely.