More than 500 prisoners have had their prison sentences calculated wrongly, the Corrections Department has confirmed.
Twenty-one will be freed today after the Supreme Court ruled yesterday that Corrections had miscalculated the release dates for two inmates.
The ruling is expected to have a much wider impact, and could lead to compensation payments for those affected.
This morning, Corrections chief executive Ray Smith said the department had "solid plans" in place to ensure the release of the 21 prisoners today were well managed from a public safety and reintegration perspective.
"Around 500 serving prisoners out of the prisoner population of approximately 9800 are also affected, and will have their release dates brought forward. In most cases this will only be by a matter of a few days or weeks rather than a significant period of time."
The figure did not include ex-prisoners.
Smith said Corrections had always followed the lawful rulings of the Court in calculating sentence release dates, and on four previous occasions the Court of Appeal had sided with Corrections.
Smith said in his statement that the Supreme Court had not made a ruling about compensation.
Corrections Minister Judith Collins will be briefed on the fall-out stemming from miscalculated parole and release dates this morning.
The lawyer for a man who successfully appealed to the Supreme Court has confirmed he will seek compensation for wrongful imprisonment, and expects thousands of others could be similarly affected.
Douglas Ewen said his client, Michael Marino, had served four-and-a-half months too long in jail, and Corrections mistaken interpretation of "time served" dated back to 2003.
"In terms of numbers of people affected it may not be a stretch to say that there are thousands of people who have been wrongfully detained in New Zealand prisons."
Ewen said it was possible the Limitation Act could reduce compensation claims, but a "huge" number of people would be affected by the groundbreaking Supreme Court decision.
Although the Government might be worried about compensation claims, Ewen said the judgment would "pay for itself in relatively short order".
"It becomes cheaper because people aren't in prison for longer than their prison sentences warranted. Only a private prison provider could lose out as a result of this."
In the judgment released yesterday the Supreme Court unanimously held that Corrections had misinterpreted the Parole Act in some instances.
Time held in detention before a person is sentenced to imprisonment is treated by the law as time already served when release dates and parole are determined.
The Supreme Court has ruled that time in detention from arrest counts as pre-sentence detention for all charges, even those that are filed after arrest.
Corrections has instead been working out time in detention on a charge-by-charge basis, meaning some people have been given jail sentences that are too long.
This was done in the case of Marino, who was taken into custody in February last year on family violence charges.
In March and June further charges were laid of attempting to pervert the course of justice as a result of telephone calls he made from prison.
Marino pleaded guilty to all charges and was jailed for 22 months, less any time already held in detention..
Corrections worked out he would get out of jail in May this year - calculating time in detention from when the second perverting the course of justice charge was laid.
That was June 19 last year - meaning he didn't get credit for the period from February to June when he was held on family violence charges.
Ewen said his client immediately knew his sentence was incorrect.
"As far as he was concerned, it was a matter of simple arithmetic."
Marino's appeals were unsuccessful in the High Court and Court of Appeal, but the Supreme Court granted him leave to appeal.
That mattered to another offender, Edward Thomas Booth, who because of Corrections' approach to calculating detention was wrongly sentenced to eight months' extra jail.
Marino is no longer in custody, but the ruling means Booth no longer needs to pursue his appeal and will have his sentence reduced.
Labour's Corrections spokesman Kelvin Davis said the mistake would cost taxpayers, and he hoped it wouldn't put pressure on Corrections' budget.
Davis said he had spoken with prisoners who had raised similar complaints about how their sentences were calculated.
Being wrongly imprisoned would make offenders angry and resentful and would make their rehabilitation harder, Davis said.
• 21: The number of prisoners immediately identifiable who could be released this week.
• 2003: The year a lawyer claims the problem dates back to.
• Thousands: Thousands of prisoners could be affected by the miscalculation, a lawyer says.
• Four-and-a-half months: The extra jail time served by Michael Marino.
• Unknown: The potential cost to taxpayers in compensation to affected inmates.