A federal judge in California has vacated his prior restraint order against the Los Angeles Times requiring the newspaper to alter a published story, marking a swift reversal on a ruling that had been criticized by free press advocates.

The decision by Judge John F. Walter of the U.S. District Court in the Central District of California came during a hearing on Tuesday, only days after he had ordered the Times to remove details from a story regarding a police officer who pleaded guilty to charges that he lied to federal investigators about his link to an organized crime syndicate.

The officer, John Saro Balian, had entered a plea agreement that was supposed to be under seal, but the agreement was posted on PACER, an online court database by mistake. A reporter for the Times found it in the database and reported on its contents in a story published Saturday.

Balian's attorney, Craig Missakian, sought the prior restraint, which was granted by the judge within hours of the story's publication. The Times complied with the order, and a note was appended to the bottom of the story indicating that references to the plea agreement had been removed.

Related: 59 news outlets rally around LA Times over judge's order to alter publish story

The Times and much of the news media community protested the decision. On Sunday night, the Times filed an emergency motion for a stay in the Ninth Circuit Court of Appeals.

And the order to impose prior restraint on a story that had already been published was viewed as extraordinary by First Amendment advocates. The Reporters Committee for the Freedom of the Press called for a reversal in a letter filed Monday in the Ninth Circuit Court; 59 news outlets, including CNN, signed the letter in support of the Times.

Norman Pearlstine, executive editor for the Times, said he was pleased with the ruling on Tuesday.

"We are glad that the district court vacated the restraining order and denied John Balian's application for a preliminary injunction. The district court recognized that we acted lawfully in downloading a publicly available plea agreement from the PACER electronic retrieval system," Pearlstine said in a statement. "We continue to believe that it was unconstitutional for The Times to be ordered to take down portions of the article on the plea agreement that we already had published. We are heartened that 59 media organizations, including The Reporters Committee for Freedom of the Press, filed an amici letter with the Ninth Circuit supporting our position that the restraining order violated our First Amendment rights."

RCFP likewise celebrated the decision.

"The Reporters Committee is very pleased that the district court reversed itself and vacated the unconstitutional prior restraint it had imposed on the LA Times," said Katie Townsend, legal director for the group. "It is the right outcome and we are glad that it happened quickly."

Missakian defended the original ruling, however, saying that the First Amendment "does not grant the press an absolute license to put another man in harm's way."

Following Walter's ruling on Tuesday, Missakian told CNN that he believes the judge's hands were tied.

"While we believe the court acted properly when it granted the original TRO, after the Times had published the sensitive information it left the court with no choice today but to vacate the order and deny the preliminary injunction," Missakian said, using the acronym for temporary restraining order.