SAN FRANCISCO - Investigators seeking a court order to search a man’s cellphone records to find out who leaked a report on the death of a San Francisco public defender failed to clearly tell a judge the target was a freelance journalist, documents unsealed Tuesday revealed.

The journalist, Bryan Carmody, had his home and office raided in May by police investigating the leak. News media groups have criticized it as a violation of California’s shield law, which protects journalists from being forced to reveal confidential sources and from search warrants.

Last week, San Francisco Superior Court Judge Rochelle East, who authorized a search of Carmody’s cellphone records, ruled the warrant never should have been issued and barred investigators from using any evidence obtained with the order.

Warrant documents unveiled under orders from the judge show that police identified Carmody as a “freelance videographer/communications manager” as provided in his LinkedIn profile.

“Further internet research revealed that Bryan Carmody is not currently employed by any of the news organizations that obtained the death investigation report,” it said.

However, it failed to note that Carmody is a freelance journalist with a press pass issued by the San Francisco Police Department.

Carmody said in court documents that he is a veteran journalist who is often the first on the scene of breaking news. He said he is paid to provide video news packages to media outlets.

He said a source gave him a preliminary police report on the unexpected death of Jeff Adachi, which contained unsavoury details. Carmody sold copies of the report along with video footage from the scene of the death and information obtained from interviews to three news stations

San Francisco Police Chief William Scott initially defended the raid and said police suspected the journalist took part in a conspiracy to steal an internal police report, motivated by profit or animosity toward Adachi.

Scott later acknowledged the searches were probably illegal and ordered reviews of protocol involving news media. On Tuesday, San Francisco Police Officer Adam Lobsinger referred to a May 24 message from Scott about his commitment to “leading a department that is transparent, accountable and reflects the values of our City.”

David Snyder, executive director of the First Amendment Coalition, which sued to unseal the documents said it’s clear police went “way overboard” and actively concealed information that Carmody is a journalist.

“The police department knew that Carmody has a press pass, and they knew he was a journalist_but failed to tell Judge East that fact,” Snyder said Tuesday. “There must be accountability, at the highest levels of San Francisco government, for this trampling on journalists’ rights.