About 500 inmates have had their jail time calculated incorrectly, the Department of Corrections says, and 21 could be freed today.
The country's highest court has found Corrections made mistakes in calculating the release dates for two inmates, and the ruling could now have a ripple effect.
The Supreme Court yesterday ruled that violent offender Michael Marino had spent about four months longer in jail than he should have, because the Department had failed to accurately factor in the time he had spent on remand. He is no longer in custody.
Corrections said it had been able to quickly identify 21 current inmates affected by the decision and they were due to be released today.
Deputy national commissioner Rachel Leota told Morning Report about 500 other inmates had incorrect release dates which would need to be changed.
"We have probably around about 500 who are in prison right now whose dates are looking likely they're to change.
"Some of those dates will be brought forward but no-one is presently out of that 500 been wrongfully detained."
The department was yet to work out how many ex-prisoners were affected.
"This could be a very large issue. Our primary priority has to be to ensure that people in prison right now have been calculated correctly against ... the Supreme Court decision ruling that was made yesterday. That has been ultimately our focus; a lot of effort has been going into preparing as best as we can for these releases and we will turn our attention to other matters shortly."
Ms Leota said no rulings had been made on compensation and this would have to go through the normal legal process.
Michael Marino's lawyer, Douglas Ewen, said sentencing laws had been confusing since 2003 and thousands of prisoners could be affected, potentially costing Corrections millions of dollars if it had to pay compensation.
However Corrrections Minister Judith Collins questioned that, given the law that applied at the time.
The essence of the Supreme Court decision was that it overturned the decisions of other courts in the last 14 years which had interpreted the law differently, she said.
"The advice I received is that Corrections complied with the law as it was, as the Court of Appeal had interpreted it, and it could not have done otherwise. Otherwise itself it would have been in breach of the law."
In his part of the judgement, Justice William Young said he believed Parliament should take another look at the legislation.
Ms Collins said that was always a possibility, but she did not believe it needed to be rushed into.