The police search on the home of investigative journalist Nicky Hager has been found unlawful by the High Court.
In a judgment released today, Justice Denis Clifford ruled against the way police went about obtaining the search warrant used to search Hager's home in the hunt for identity of the hacker Rawshark who supplied information for the Dirty Politics book.
The judgment also delivered police a rap on the knuckles for the way they went about allowing Hager to claim journalistic privilege, saying the way detectives went about it was "not the type of facilitation that I consider the Search and Surveillance Act anticipates".
He also said detectives sought the search warrant with little more than a "hope" they would find useful information.
Hager said the court victory was important "for his family and because of the important principles it upholds". He also declared it to be "very good news for New Zealand journalism".
He said the decision would have an impact on all news media and whistle blowers.
"The heart of the case is the public's right to receive information about the actions of people in positions of authority. This decision acknowledges that confidential sources used in investigative journalism, in this case my book Dirty Politics, deserve legal protection.
"I'm very happy and relieved. I can't do my job if I can't protect sources and if I can't do my job then I can't help the public get information."
Assistant commissioner Malcolm Burgess said police would "consider further legal options".
Media Freedom Committee chairwoman Joanna Norris said it was a good result for journalism.
She said the ruling it acknowledged the importance of journalists being able to protect their sources.
"Journalistic sources should be able to be protected because it underpins our role as watchdogs."
Ms Norris said police applying for search warrants involving journalists should understand the principles at play in relation to the law and also be explicit about what they were seeking and why it was needed.
She said Hager's status as a freelance journalist should make no difference in the way police approached obtaining a search warrant.
She said he should be treated by police in the same way it would have dealt with a large media organisation.
Labour's shadow attorney-general, David Parker, said today's ruling meant police had acted unlawfully during two elections in a row against journalists.
"For the past two elections, complaints in the media from the Prime Minister have led to inappropriate and excessive action by the police against journalists. In 2011, it was the tea tapes, following a media stunt gone wrong between John Key and John Banks," Mr Parker said.
"Last year, the disreputable antics of the National Party involving Whale Oil blogger Cameron Slater, Jason Ede in the Prime Minister's office, Judith Collins, and the Prime Minister himself were outed in Nicky Hager's book Dirty Politics."
Mr Parker said Hager had been painted as a villain by the Government after the release of his book and today's findings vindicated him.
"Instead of the police attention being on the perpetrators, John Key kept asserting Nicky Hager based his book on hacked emails. The police in turn reacted on the public complaints by the Prime Minister and the formal complaint by Cameron Slater, and again turned on the media."
Mr Parker said police and the Prime Minister needed to publicly accept that the politicisation of the police was serious and wrong.
The case came after Hager challenged a police search warrant used in the hunt for the hacker Rawshark, who took email and other information from blogger Cameron Slater.
Hager used the information for his Dirty Politics book, which was a bombshell at last year's election for its claims of a close relationship between the office of Prime Minister John Key and Slater, who runs the Whaleoil blog.
Police turned up at Hager's house in October last year with a search warrant while Hager was in Auckland.
Detectives met his daughter at the door, told her of the warrant then talked to Hager by phone to tell him why they were there. Hager told detectives there was nothing in the house which would identify Rawshark but spoke of concern about other confidential source information he held.
Hager told the High Court - in a challenge to the search warrant - that he was able to claim journalistic privilege under the Evidence Act, and a breach of the Bill of Rights. It was also claimed the warrant was too broad.
Hager's lawyers also told the court police had gone about applying for it in the wrong way by not properly investigating other leads, and had "failed more generally to discharge the duty of candour" by telling the judge the state of their investigation and what might likely come from executing a warrant.
Justice Clifford said there was "no explicit reference" in the warrant application put before a district court judge to "Hager's status as a journalist", to legal principles around search warrants executed on journalist, to the legal rights journalists had under the Evidence Act or to the way those rights were explained in the Search and Surveillance Act.
He said Parliament would not have intended for a judge to be kept blind to the possibility of journalistic privilege in an application for a search warrant. He said Parliament would also not have intended for a judge to not be informed about the principles which arose as a result.
Justice Clifford said it was important not only for the judge to be aware but for judges, when deciding to grant warrants, to be satisfied police were also aware of the issues and had appropriate steps in place to deal with information on which privilege was claimed.
The result, said Justice Clifford, was "a material failure to discharge the duty of candour" by police.
"The central issues relating to the lawfulness of the warrant were not drawn to Judge (Ida) Malosi's attention. Those issues reflect fundamentally important public interests."
He said there were also questions over the "reasonable belief" police had that they search would produce evidence of Rawshark's identity.
"My concern is that reasonable belief, on the material I have been provided with, might better be characterised as hope."
Justice Clifford also addressed evidence from witnesses before the court that the search could discourage those with important information from coming forward to media.
"In my view, the chilling effect of the issue of the warrant and its execution need to be seen in that content, and those matters also drawn to Judge Malosi's attention."
He said the warrant was "fundamentally unlawful" and because of that "fundamental failure to disclose relevant information" the search was unlawful.
Justice Clifford said he found the warrant unlawful on "candour" issues and had not examined the Bill of Rights issues. However, he said beyond the application process used to secure the warrant, he had "some reservation as to the reasonableness of the way in which ... the search was undertaken".
The case is not over - Hager has other stands in which he seeks costs and damages from police.
• David Fisher gave evidence as an "expert witness" in the Hager v Police case under High Court rules that require an "overriding duty to assist the court impartially on relevant matters".