Labour's justice spokesperson Jacinda Ardern said the Government should repeal the ban. The ruling was unprecedented and a "wake-up call" for the government.
"This was an arbitrary law and one that is full of contradictions and inconsistencies." She said the Government had ignored advice from the Attorney-General and rulings by the UN and European Human Rights Committees in voting for the bill.
"Parliament has a responsibility to respect fundamental rights for all. The Government now has a responsibility to assure all New Zealanders it understands that,"
The declaration alone does not mean Parliament must repeal the ban -- the court noted that even where it finds Parliament has placed unjustified limits on rights. it still has to apply that law.
In his decision, Justice Paul Heath said the purpose of the declaration was to "draw to the attention of the New Zealand public that Parliament has enacted legislation consistent inconsistent with a fundamental right".
The case was taken in 2013 by Arthur Taylor, a self-described 'prison lawyer' and criminal, along with four women prisoners from Christchurch Women's Prison.
Taylor also successfully sought rulings in 2012 that a smoking ban on prisons was unlawful.
Until 2010, only prisoners serving terms of more than three years were prohibited from voting. That law changed in 2010 to cover all prisoners after a member's bill by National's Paul Quinn, who is no longer in Parliament.
Justice Heath said his decision related only to the blanket ban and not the earlier ban on prisoners serving more than three years. "There are powerful arguments that the limitations on the prohibition contained in the original [Act] are justifiable in a free and democratic society."
However, he ruled the wider ban was unjustified. While rights could be limited if the limits were reasonable and justified, that was not the case in this instance.
The court said the the blanket ban produced arbitrary results, so that a low-level offender serving a short term which happened to overlap with an election could not vote but a more serious offender who had served more than two years in between elections could.
It also meant someone who was in prison simply because a suitable home detention address was not available could not vote, while others on home detention could.
It is the first time the court has issued a declaration of inconsistency in relation to the Bill of Rights Act.
The Act itself does not contain penalties for breaches but the courts have in the past offered compensation in cases where individual rights were breached, and Justice Heath ruled it could also offer declarations under the Act.