An urgent rule change by the Corrections Department which banned smoking in prisons has been ruled unlawful by a High Court judge.
Justice Brewer said that Corrections went beyond its powers when it banned tobacco and smoking equipment last year.
The ruling was the second court victory for career criminal Arthur Taylor, who has led the battle against the anti-smoking rules.
Last year, Mr Taylor successfully challenged a blanket ban on smoking introduced in July 2011. The High Court ruled in December that this ban was unlawful.
Corrections responded by introducing regulations to ban tobacco and smoking equipment. Mr Taylor again challenged this in the High Court.
In a decision released this morning, Justice Brewer said the regulations were "unlawful, invalid and of no effect".
The ruling did not mean that prisoners would be able to smoke because legislation was amended in February to validate the Corrections regulations which banned smoking.
Justice Brewer noted that there was public interest in the Court determining whether prisoners had been subjected to unlawful regulations.
Justice Brewer said in his judgement that if the anti-smoking regulations were declared invalid, prisoners who were disciplined would be able to apply for compensation.
He said the compensation could include correction of a inmates' disciplinary record - an adverse record could affect parole decisions.
But Corrections chief executive Ray Smith said the amendments to legislation in February ruled out compensation for prisoners who challenged penalties given to them for possessing tobacco.
Mr Smith confirmed that prisons would remain smokefree because of the law changes, which came into force in March.
"Implementing smokefree prisons was always going to be a serious challenge and it has gone incredibly well and without major incident. We are the first national prison service to achieve this."
He said that since the introduction of smokefree prisons the work environment had improved for staff and prisoners, with better air quality and fewer fires.
Prisoners were given 12 months to quit smoking before the blanket ban was introduced in July 2011.
Mr Smith said many prisoners were now healthier and had more money and contact with family members because they were spending more on phone cards than cigarettes.