Sensitive online information will be handed over as early as next week, from cloud storage company Mega to a Central Asian government pursuing dissident hackers.
Kazakhstan is pursuing the source of a major hack of confidential emails by high-ranking government officials to a newspaper, Respublika, which has been accused of extremism and was banned after criticising the government.
Mega has failed in a New Zealand High Court bid to limit the amount of information - including IP addresses, email and other account information - that will be filed in a court in New York.
Mega had argued that it was an unnecessary breach of privacy.
Kazakhstan has been trying for 18 months to expose the source of a hack of government computers which exposed confidential emails, and has issued subpoenas to Facebook, Microsoft and Google in the US.
The 100,000 documents include information on the dealings between two big banks and extravagant spending by the long-time Kazakhstan president Nursultan Nazarbayev.
The High Court in Auckland has ruled that releasing the information from Mega was essential to identifying some of the 100 unnamed defendants, thought to be the hackers, targeted in civil proceedings in New York.
Joanna Lillis, a reporter in Kazakhstan, said the ruling was a win for the country's autocratic government.
"The New Zealand court ordering Mega to release ... data to the Kazakhstan government's legal team is a massive step forward and certainly probably the biggest victory in this long-running court saga so far."
Some of the hacked material ended up online, including on a Mega website, which drew New Zealand into the case.
The New York court asked the New Zealand courts to subpoena Mega to find out who uploaded the files linked to what it called "stolen material".
The High Court in Auckland [http://www.radionz.co.nz/news/national/303729/mega-told-to-hand-over-information did so back in May; and its second ruling yesterday ends Mega's attempt to limit the handover to material from only one user.
Instead, the court has ruled all the material is relevant and has authorised Kazakhstan's New Zealand lawyer Daniel Kalderimis to send over four pages with details about five users to New York.
"It will be by email but sent in a secure way, probably early next week," he said.
Mega's chair Stephen Hall said it was handing the information over under protest.
"Our fear is the information we have provided - and the most we have given is an email address - but that will be then taken by the US process and they will go to the email suppliers, whether it's Google ... or whoever, and try and further trace who is behind that email account," Mr Hall said.
"And with the record of the Kazakhstan government - they have recently arrested and jailed journalists, opposition leaders, demonstrators - our concern is that people could end up being jailed or worse merely by association with this material."
Mr Hall said he had seen nothing in the material to suggest Mega's users were the hackers Kazakhstan was after.
Mr Kalderimis said the the proceedings were for an injunction to stop leaked and hacked materials being disseminated.
"So any further, wider ramifications are perfectly capable of being dealt with by the New York judge and that was the approach the New Zealand court took."
Amnesty International earlier this year accused Kazakhstan of turning a blind eye to more than 100 reports of torture.
Kazakhstan's president has accused the journalists who published some of the hacked information of working for a political rival.
Earlier this month his own government was accused by lobbyists in the US of sending malware to journalists.
Ms Lillis said it was a bitter struggle.
"There's no denying that the court does help the repressive Kazakh government.
"However, the legal basis for the court ruling is obviously a different matter.
"But what I suppose what the New Zealand government could be doing would be issuing some kind of statement in support of freedom of speech in Kazakhstan at a time when this case is going forward."
Earlier, Kazakhstan's subpoenas in the US had foundered on the US Constitution's First Amendment, with a series of three judges ruling in favour of freedom of the press.