The appeal to allow a land exchange for Hawke's Bay's Ruataniwha Dam has been dismissed by the Supreme Court.
The court was considering whether the Department of Conservation could swap 22ha of the Ruahine Forest Park for 170ha of private farm land.
The protected conservation land needs to be flooded for the country's largest irrigation project to go ahead.
Justice Susan Glazebrook said in Wellington this morning that most of the Supreme Court judges have affirmed an earlier decision of the Court of Appeal.
A group of people opposing the land swap gathered outside the court room after the decision, sharing hugs. One woman was jumping in excitement.
Last year, the Court of Appeal ruled the land swap was illegal, so the Conservation Minister took the case to the Supreme Court.
The Hawke's Bay Regional Council would invest $80 million in the project if it goes forward.
Forest & Bird, which successfully appealed the deal, claims it could put millions of hectares of other protected land under threat from private development.
This issue has nationwide significance for all forest parks and how they are protected in law, Forest & Bird said.
In 2015, DoC reclassified 22ha of Ruahine Forest Park as stewardship land, to make the land available for the Ruataniwha dam.
Had DoC's reclassification stood, it would have created a legal precedent affecting all Forest Parks in New Zealand, Forest & Bird said.
"Many of these areas have economically valuable resources, such as water, gold, minerals, etc. All these areas will lose the strong protection they currently have, and instead become available to commercial interests.
"Developers all over the country will be watching this decision closely to see if they will now be able to acquire specially protected public conservation land. Forest and Bird know of two proposed public conservation land-swaps dependent on this ruling: one in Richmond Forest Park, and one at Lake Sumner in Canterbury."
Forest & Bird previously argued the land exchange triggers the need for DoC to look at reserving marginal strips - 20m strips of conservation land - along any waterway within the conservation land being disposed of.
"Both DoC and the dam company had argued that when DoC gives land away as part of an exchange, this is not a disposal and the marginal strips issue doesn't arise."
Forest & Bird general advocacy adviser Kevin Hackwell said they were "very pleased" with the decision, but disappointed the Minister for Conservation "was actually fighting against her own legislation".
It had been Forest & Bird's position from the beginning that the Department of Conservation was not following the legislation correctly.
"We've gone through, now, three lots of appeals. Supreme Court has come up and agreed, yes, we were right, just like the Appeal Court did."
Hackwell said the decision would help keep other specially protected land in New Zealand safe.
"We've reinforced the fact that it is specially protected and you can't just at the stroke of a pen give it up for development."
The decision showed that specially protected land could not have its status revoked unless the values for which it was given that status in the first place were no longer there.
"We've made it clear that if the department wants to take land out of specially protected status, then it has to have lost its values - that's the important thing. It can only be removed from that status if the values for which it was protected have disappeared."
The decision also reinforced that DoC also had to work under statutory planning documents.
"They had the gall to argue those statutory documents had no effect. No, the Supreme Court has said 'sorry guys, this is the law, these are statutory documents, you have to use them and you have to apply them'."
Hackwell said that was a "very, very important thing for conservation".
The concern now was whether the Government would change legislation after this decision, he said.
Today's court hearing reserved costs, but said parties could make a written application to seek costs.
Greenpeace has called the decision a "major victory in the struggle against big irrigation and the nationwide intensification of dairying".
"The Ruataniwha dam would have meant more industrial dairying and more pollution in our rivers so today's court ruling is also a win for our rivers," said Greenpeace campaigner Gen Toop.
"Conservation land belongs to all New Zealanders, not to companies wanting to destroy it for private profit. " she says.
Nearly 90,000 people have signed a petition demanding the Government stop funding big irrigation schemes.
Greenpeace is demanding those irrigation subsidies be spent on a transition fund to more sustainable forms of farming.