A federal judge on Saturday directed the Los Angeles Times to amend a story about a California police detective who was accused of working with the Mexican mafia after sealed court documents were accidentally made available online.

The article described a plea agreement between prosecutors and 45-year-old detective John Saro Balian. But the plea deal, which was supposed to be filed under seal, was accidentally made available in a public online database of federal court documents, according to the Times.

Shortly after the article was posted on Saturday morning, Balian’s attorney sought a temporary restraining order, which the judge granted later that afternoon.

“To the extent any article is published prior to issuance of this order, it shall be deleted and removed forthwith,” U.S. District Judge John F. Walter’s wrote in a ruling.

Following the decision, the Times removed any references about the sealed agreement, though pledged to challenge the ruling.

"We believe that once material is in the public record, it is proper and appropriate to publish it if it is newsworthy." — The Los Angeles Times’ executive editor Norman Pearlstine.

“We believe that once material is in the public record, it is proper and appropriate to publish it if it is newsworthy,” said the Times’ executive editor Norman Pearlstine.

“Typically, courts take into account if information was already published. Where it is no longer secret, the point of the restraining order is mooted,” said Kelli Sager, an attorney representing newspaper. “To order a publication to claw it back doesn’t even serve the interest that may be intended.”

Peter Scheer, former executive director of the First Amendment Coalition, told the outlet that writing about the plea deal was “fair game” as it was put in the public domain.

“A news organization that wishes to write about the content has the right to do so under the First Amendment,” he said. “Whether or not a journalist should is a matter of editorial discretion or journalistic ethics. It’s a separate matter. It’s not a legal matter.”

Detective Balian pleaded guilty last week to three counts, including lying to investigators about his ties to organized crime, accepting a bribe and obstructing justice after tipping off a top criminal about a federal raid, the Los Angeles Times reported.

His stint as an allegedly corrupt detective came to an end after the FBI’s Eurasian Organized Crime Task Force identified him as a person of interest after investigating links between the Mexican Mafia and Armenian organized crime.

One informant told the authorities that Balian tipped off a gang member in Los Angeles about an incoming raid. “Tell your boy Bouncer that he’s the No. 1 on the list for tomorrow,” Balian allegedly said, according to the Times.

Balian also allegedly gave the informant locations of marijuana grow and stash houses and told him to “hit them” before the authorities could sweep the locations.

He currently remains on unpaid leave and last Friday a judge denied his request to be released on bond.