"The ministers' consent to overseas investment to be made by Milk NZ in the Crafar farms is set aside. I direct that the ministers reconsider Milk NZ's application."
Justice Miller noted relevant legislation was intended to allow overseas investment in farm land only where that investment was likely to benefit New Zealand.
However he observed that the benefits of Shanghai Pengxin's ownership of the land were likely to accrue no matter who owned it.
"If a given benefit will happen anyway, it cannot easily be described as a substantial consequence of the overseas investment," he said.
While Shanghai Pengxin's applications highlighted its intention to invest further in the farms in order to improve them, Justice Miller said any purchaser with cash was likely to do so anyway.
"That being so, the economic benefits caused by the overseas investment were materially overstated in the OIO's recommendation."
Justice Miller said Mr Williamson and Dr Coleman had "misdirected themselves in law" by adopting the OIO's interpretation of the relevant legislation.
Shanghai Pengxin spokesman Cedric Allan said the company was "astonished" by the decision.
"Firstly as far as we can tell there's never been a requirement in any application to the Overseas Investment Office to contrast the benefits which the applicant is bringing to the country with the theoretical benefits which might be obtained by some New Zealand based person buying the same assets."
Mr Allan said Shanghai Pengxin did not intend mounting a legal challenge to Justice Miller's decision.
"We'll just patiently wait."
Shanghai Pengxin remained committed to its offer and he would be surprised if the Crafar farms receivers Korda Mentha did not allow time for the OIO and ministers to reconsider it.
Mr Williamson and Dr Coleman this afternoon said they expected that would take "days not weeks".
The OIO took nine months to make its initial recommendation to the ministers.
Prime Minister John Key faced a barrage of criticism over his ministers' decision to approve the Shanghai Pengxin bid in Parliament, just minutes after the court's decision was revealed.
He said Mr Williamson and Dr Coleman - who had said they did not have legal grounds to oppose the bid - had acted correctly accepting the OIO's advice to approve the sale.
"It's not for ministers to try to rewrite the decisions of the OIO," he said.
The High Court decision meant the OIO would have to reinterpret its decision to recommend the sale to Government, Mr Key said.
"Ministers apply the law as its understood.
"We now have new jurisprudence and you're quite right that the OIO... have to consider this ruling."
Mr Key also denied that it was a massive embarrassment for the government.
"The Government follows the procedure very carefully, which is section 16 and 18 of the Overseas Investment Act have to be complied with, if they are complied with then ministers have very limited options to decline an application. The question is whether the Overseas Investment Office correctly interpreted the benefits test in one of those two sections, so it's not a matter for the Government."
Mr Key said he was waiting on opinions about the decision from Crown Law and the OIO.
"We anticipate getting some of those opinions later this afternoon, from here we'll just have to see where it goes," he said.
"I guess eventually the Overseas Investment will have to go back and look at the application again, and apply the new test as they're prescribed by the judge this afternoon."
New Zealand First leader Winston Peters, who strongly opposed the sale, told media the decision came as no surprise, and he had never believed the economic tests had been satisfied.
Mr Peters said there was no doubt the Government had entered the process with a predetermined view.
"You have two two junior ministers who totally let down the national interest, I have no doubt there were other influences as well," he said.
Spokesman for Sir Michael's consortium Alan McDonald said the decision was welcome and it confirmed the reasons for the group's opposition to the Shanghai Pengxin bid.
"Our view was that Shanghai Pengxin's offer brought no real economic benefit to New Zealand and it was not in the best interests of New Zealanders. It is reassuring that a High Court judge has come to a similar conclusion and set aside the Ministers approval," he said.
Mr McDonald said the consortium and its legal team were now taking time to fully consider the details of Justice Miller's decision.
Shanghai Pengxin Group's purchase of the 16 farms for a reported price of $210 million remains conditional.
Strict conditions were applied to the sale, including that the company only invest in milk processing facilities that are at least 50 per cent New Zealand-owned.
- additional reporting APNZ and Herald Online staff.