The High Court has ruled the use of farrowing crates for pigs unlawful and wants changes to the legislation.
Two animal welfare groups, SAFE and New Zealand Animal Law Association took the attorney general, the minister of agriculture and the national welfare advisory committee to court in June saying the use of farrowing crates and mating crates breached the Animal Welfare Act 1999.
Farrowing crates are cages that keep a sow in a confined spot during the final months of her pregnancy and while she is suckling her piglets.
In its decision out today, the court said the agriculture minister must consider new regulations phasing out the use of farrowing crates and mating stalls, and improve minimum standards.
SAFE chief executive Debra Ashton said farrowing crates were a cruel and inhumane way of treating pigs and today's decision was a step in the right direction.
"This is a brilliant outcome for pigs and it has set a precedent for other codes of welfare for animals," she said.
"We decided to take the matter to court because we had exhausted all other ways for standing up for the mother pigs ... litigation was the only other option for us."
She said the process of phasing the crates out must start as soon as possible.
"There will be a transion period for farmers to move away from the crates but we want to see that happen as possible.
"Mother pigs have suffered for way too long already."
The pork industry said the judgement would have a significant impact on farmers.
New Zealand Pork Animal Welfare Scientist and Advisor Kirsty Chidgey said more than half of pig farmers used farrowing crates. She said it is important to consider piglets in this.
"Piglet crushing is one of the main causes of piglet mortaility, and farrowing crates is the best way to stop that."
Chidgey said 60 percent of pork consumed in New Zealand came from countries overseas with worse animal welfare practices than New Zealand.
"One consequence of this could be fewer farms exist in New Zealand and more pork will be imported from those countries."
Ministry for Primary Industries veterinarian and director for animal health and welfare Dr Chris Rodwell said they would be looking carefully at the judgment before considering next steps and providing advice to ministers.
"We're committed to working with the industry and stakeholders to ensure high animal welfare standards," he said.