Prisoners who were kept in jail for too long because of miscalculated sentences could claim millions in compensation.
Earlier this year the Supreme Court ruled Michael Marino was held for four months longer than he should have been, because his sentence was taken from the wrong starting date.
The Crown then filed a case with the High Court, arguing for the decision to only apply to future cases.
But in a judgment released today, High Court Justice Simon France said that wasn't the traditional approach, and that prisoners had the right to seek compensation.
Marino's lawyer, Douglas Ewen, said the issue will have affected thousands of prisoners, and they will all have a case for compensation.
"When the judgment came out, the deputy Commissioner of Corrections said 500 people had their sentences automatically adjusted because of it.
"So as a snapshot of one day, in one month, in one year, it was 500 people affected.
"Considering this issue goes back to 2003, you do the maths."
The law was unclear on how much compensation each prisoner could be entitled to, Ewen said.
But if more prisoners take action, the total would be in the millions.
"I don't want to hold a gun to their heads, but equally I want them to be reasonable.
"In human rights terms it's one of the biggest decisions a New Zealand court has delivered.
"It is important we state that the Government does not get to break the law and pretend that it didn't happen."
In his written decision, Justice France emphasised the case was serious.
"The right not to have one's liberty removed other than with lawful authority is a key plank of our society, and one of its most important and fundamental rules.
"In this case, [being incorrectly locked up] happened without fault on the part of Mr Marino, and without him being able to prevent it.
"It happened because successive courts (as has now been held) misinterpreted the Act."
Marino is understood to be seeking tens of thousands in compensation.
A case on how much compensation should be paid is likely to go before the High Court next year.
In October, Corrections Minister Judith Collins said the release date error could affect thousands of prisoners.