Megaupload boss Kim Dotcom won the right Thursday to sue New Zealand's foreign intelligence agency for illegally spying on him ahead of his arrest as part of a US probe into alleged online piracy.
The High Court also ordered the Government Communications Security Bureau (GCSB) to disclose details of any information-sharing arrangements it had with foreign agencies, including US authorities, before Dotcom's arrest in January.
Dotcom's US-based lawyer Ira Rothken hailed the decision as a major victory for the Internet tycoon, who is fighting a US attempt to extradite him from New Zealand in what has been described as the world's largest copyright case.
"Today's @KimDotcom judgment shows the NZ democracy works as the judiciary orders discovery & acts as a check & balance on illegal gov(ernment) spying," he tweeted.
It emerged in September that the GCSB spied on Dotcom before police raided his Auckland mansion, even though he is a New Zealand resident and should have been off-limits to the agency.
Following the revelation, which prompted an apology from Prime Minister John Key, Dotcom applied to include the GCSB in a lawsuit he is planning against New Zealand police alleging wrongful arrest.
High Court chief judge Helen Winkelmann granted the request Thursday, rejecting the GCSB's argument that it should be denied because such legal action could potentially damage national security.
"I have no doubt that the most convenient and expeditious way of enabling the court to determine all matters in dispute is to join the GCSB in the proceedings," she said in a written judgement.
Armed police raided Dotcom's mansion in January but a court later ruled the search warrants used were illegal, opening the way for him to seek damages from New Zealand authorities.
Dotcom's lawyers have not detailed how much compensation they want but opposition political parties said the amount could be substantial.
"This will end up costing taxpayers millions of dollars in legal fees to fight the case and in compensation to Dotcom," New Zealand First leader Winston Peters said.
US authorities allege Dotcom's Megaupload and related file-sharing sites netted more than US$175 million and cost copyright owners more than US$500 million by offering pirated copies of movies, TV shows and other content.
Dotcom, who changed his name from Kim Schmitz, faces an extradition hearing in March.
Explore further: Why are women leaving the tech industry in droves?