Journalists had an important public watchdog role and that included talking to people who had important information to reveal but who would feel compromised if their identity was revealed, he said.
Forcing the TV3 staff to testify would have a chilling effect, stopping people in such cases in future coming forward with important information, Mr Miles said.
As a fallback position, Mr Miles said the testimony was not necessary as prosecutors already had enough information to put the accused before a court.
"If the Crown already has a case it thinks is good enough to put before a jury, it doesn't need this top-up."
Mr Miles rejected suggestions the law was more to protect whistleblowers who went to media rather than people who may be admitting to a crime, saying the right to protect sources should only be overturned in extremely serious cases.
But police lawyer Lance Rowe disagreed, saying the law was put in place to protect whistleblowers more than any other groups.
"This is not a case where the media is carrying out the function of being public watchdog, which is reason we have this protection in the first place," he said.
"What is it exactly that's being protected here?"
Mr Rowe said that the revealing of the identity of the person TV3 interviewed could play a major part in the prosecution and was therefore in the public interest.
He said that under the law journalists could never promise absolute confidentiality to a source "unless they're also promising to go to prison for contempt of court".
Mr Miles said TV3 was prepared to hand over transcripts of both the original interview with the informant and of the "interview" with the actor that was eventually broadcast.
Justice Randerson reserved his decision.
Several suppression orders relating to the accused and to evidential matters were also made.
- NZPA