The New Zealand Police have apologised to investigative journalist Nicky Hager for a raid on his house following the publication of Dirty Politics in 2014.
The High Court ruled the 10-hour search of Mr Hager's home was "fundamentally unlawful" in 2015.
In a settlement on Tuesday, Police accepted they attempted to breach Mr Hager's journalistic privilege and that they did not have reasonable grounds for the search.
- Nicky Hager book show's National's 'dirty politics'
- Key opens up about Dirty Politics, Collins resignation
- Parents of Afghan girl killed plead for NZ govt inquiry
Mr Hager will receive a pay-out for legal costs and damages as part of the settlement.
"This sends a vital message that people can share important information with journalists with confidence that their identities will be protected," Mr Hager said.
Police acknowledge they should have sought a production order when they sought 10 months of Mr Hager's banking transactions.
The Police apology says the search warrant obtained to search Mr Hager's home should have raised and addressed concerns around journalistic privilege.
"Police failed to mention in their application for the search warrant that they sought information to identify one of Mr Hager's confidential sources and failed to mention that Mr Hager was a journalist who could claim journalistic privilege," Police's apology says.
Police have acknowledged Mr Hager was right to expect his confidential sources would be kept private.
"After the search, Police continued the investigation by seeking and obtaining Mr Hager's private information from various third parties including Air New Zealand, Paypal, NZ Customs, and Jetstar. When Police used production orders, they should have and failed to disclose Mr Hager is a journalist who is entitled to claim privilege."
The amount of damages paid by Police has been kept confidential.
Professor Ursula Cheer of Canterbury University law school said Police must allow journalists to claim source confidentiality before carrying out a search.
"This is a vital win for journalists, their sources and freedom of expression, both nationally and internationally," she said.