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."

Most significantly, that number does not include ex-prisoners. And that's where this is going to get expensive. Because if Corrections has calculated release dates wrongly for 5% of serving prisoners, they've probably done it incorrectly for those who have completed their sentences as well. Which means there could be thousands of victims. And while the average oversentencing seems to be a few months (suggesting compensation in the order of tends of thousands of dollars), that's very obviously going to get very expensive very quickly. And so it should: if the government imprisons you illegally, they should damn well pay through the nose for it.

Except they won't. Based on this government's past behaviour, they'll probably ram through a law under urgency to limit their exposure (and score some "tough on crime" votes) by removing the right to compensation for this false imprisonment by the state. Because that's how Judith Collins and friends roll...

meanwhile, you really have to question the basic competence of Corrections if they can't calculate a release date properly, and it really makes you wonder what else they're doing wrong.