A police raid on New Zealand journalist Nicky Hager's home has been ruled as illegal, the High Court has found.
In a judgment released today, Justice Denis Clifford ruled against the way police went about obtaining the warrant used to search Hager's home.
They were hunting for the identity of the hacker who supplied information for Mr Hager's Dirty Politics book.
Mr Hager wrote Dirty Politics relying, to a significant degree, on material hacked from the computer of Cameron Slater.
Mr Hager obtained that material from a person who he promised confidentiality.
Mr Hager stated publicly on several occasions that he knew who his source was, but he wouldn't disclose his identity.
After the publication of Dirty Politics, Mr Slater complained to the police about the unlawful access to his computer, which had generated the material Mr Hager used.
In late-September of this year, as part of their investigation of Mr Slater's complaint, the police obtained a warrant to search Mr Hager's home.
They executed that warrant on October 2.
During that search, Mr Hager raised a claim of privilege, based on section 68 of the Evidence Act 2006.
Section 68 makes journalists not "compellable" in civil or criminal proceedings to answer questions or produce documents that would disclose the identity of a confidential source.
The police seized and sealed, but did not search, Mr Hager's computers and paper files.
They were delivered to the High Court in Auckland, where they remain.
The police then started proceedings to have Mr Hager's claim to privilege determined by the High Court.
The judge determined that the warrant was fundamentally unlawful.
"It follows from this fundamental failure to disclose relevant information that the search was also unlawful," the judge said.