A federal judge ruled Friday that CNN correspondent Jim Acosta can keep his White House credential for now, handing a victory to CNN in its lawsuit against President Trump and top White House officials. Judge Timothy J. Kelly, a Trump-appointed judge, granted CNN its request for a temporary restraining order to force the White House to return Acosta's credential.

Last week, White House press secretary Sarah Sanders announced that Acosta's hard pass — the White House access pass granted to some journalists after a rigorous background check process — was being revoked after Acosta had a testy exchange with the president in last week's press conference. The White House initially justified revoking Acosta's access because they said he placed hands on an intern in the televised news conference. But their arguments submitted to court didn't mention that as a reason for revoking the pass.

Kelly found that since the president did not inform Acosta at the press conference that he would or could have his credential taken, that Acosta's due process rights under the Fifth Amendment had been violated. Therefore, Kelly said, Acosta was never given a meaningful opportunity to rebut the White House's decision.

Get Breaking News Delivered to Your Inbox

"The need for the opportunity to be heard seems especially important in this case," Kelly said.

Kelly also held that Acosta suffered "irreparable harm" as a result the revocation. This has to do with "the liberties of the individual journalists themselves," Kelly said, and told the court that "each day he is deprived of that interest," Acosta suffers a harm that cannot be remedied.

At this point, Kelly said, "I have not determined the First Amendment was violated here."

Read more:

The White House credential, known as a hard pass, gives journalists access to the White House briefing room, to press conferences and White House events. The hard pass enables journalists to be quite close to the president at times. President Trump often makes himself available to the press, speaking with them during photo opportunities and as he is leaving for trips. He has so far, CBS News' Mark Knoller notes, had more press availabilities than his two predecessors combined at this point.

After the court proceeding, Acosta emerged from the courtroom and briefly thanked his colleagues in the press for their support this week. "Let's go back to work," Acosta said.

White House press secretary Sarah Sanders issued a statement in response to the ruling, affirming that the White House would "temporarily reinstate the reporter's hard pass." She added that the White House will also "further develop rules and processes to ensure fair and orderly press conferences in the future. There must be decorum at the White House."

The plaintiffs are expected to return to the court next week.

On Wednesday, Kelly heard from both sides' lawyers, with the attorney representing CNN arguing the White House is infringing on Acosta's First and Fifth Amendment rights, and the attorney representing Mr. Trump and others named in the suit claiming White House access is up to the president's discretion.

"If the president wants to exclude all reporters from the White House grounds, he clearly has the discretion to do that," James Burnham, the lawyer for the government, argued.

Theodore Boutrous, Jr., the lawyer for the plaintiffs, pointed out that the White House has "come up with four different reasons" for revoking Acosta's access.

Fox News, CBS News, and other media outlets have signed onto an amicus brief in support of CNN and Acosta.

"We do not believe that revoking White House press credentials is an appropriate remedy for a disagreement the White House may have with a particular reporter," CBS News said in a statement. "We intend to file a friend of the court brief in support of CNN's lawsuit to defend its constitutional rights."

— CBS News' Clare Hymes and Paula Reid contributed to this report