Updated at 11:48 a.m.

The Trump administration must restore the press credentials of a CNN political reporter who has been denied access to the White House, a Washington federal trial judge ruled Friday, handing a blow to a president who has continually bashed some media organizations as “fake news” and called reporters “enemies of the people.”

U.S. District Judge Timothy Kelly, appointed by Trump last year to the federal trial bench, handed down the decision Friday after hearing arguments for two hours earlier this week. Kelly had initially planned to issue his decision at a Thursday afternoon hearing but postponed his announcement until Friday.

Kelly based his decision largely on a 1977 decision by the Washington federal appeals court, which established that the White House must provide due process when revoking a reporter's press credentials. “I simply have no choice but to apply that precedent,” he said.

Kelly said CNN and Jim Acosta, represented by Gibson, Dunn & Crutcher, demonstrated a “likelihood of success” on its claim that the White House did not engage in an adequate process. He said whatever process that was provided to Acosta is “still so shrouded in mystery,” noting that the government could not definitely identify the official who made the initial decision to revoke Acosta's credentials.

Outside the courthouse, Gibson Dunn partner Theodore Boutrous said: “This is a great day for the First Amendment and journalism.” Acosta, in a nod to briefs from media organizations backing his position, thanked his press colleagues for their support. “And let's go back to work,” he said.

The White House said in a statement:

“Today, the court made clear that there is no absolute First Amendment right to access the White House. In response to the court, we will temporarily reinstate the reporter's hard pass. We 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.”

At Wednesday's hearing, Kelly explored how he should consider “the unprecedented nature of what's happened here.” Justice Department attorney James Burnham said the president enjoys wide discretion to control press access to the White House.

“He clearly has the authority to do that,” Burnham said of the president's power to revoke a reporter's press credentials. Burnham said an order requiring the White House to restore Acosta's credentials would amount to an “intrusive form of relief,” adding that such a ruling would have the effect of countermanding the president's directive for “who can enter his space.”

“I am not aware of any precedent for that sort of judicial relief,” Burnham said.

Burnham also downplayed the importance of Acosta having access to the White House. He noted that CNN has about 50 other employees with press passes and that, by watching televised broadcasts of Trump's appearances, Acosta could “report on them just as well as he could if he was in the room.”

Boutrous, representing CNN, in court this week described Burnham's view of journalism as “warped.”

“That's not how reporters break stories,” Boutrous said, calling the media's access to the White House “highly valuable.”

Burnham had framed the White House's decision as driven not by Acosta's critical coverage of the administration but rather his behavior at a Nov. 7 press conference, during which he declined to give up a microphone or yield to other reporters waiting to ask questions. The White House initially said Acosta placed his hands on a White House intern who was trying to retrieve Acosta's microphone.

“Grandstanding and disrupting a press conference,” Burnham said, “is just not a viewpoint.”

Kelly, however, on Friday questioned the accuracy of that accounting of the interaction between the intern and Acosta.

Boutrous, joined in court by Gibson Dunn partner Theodore Olson, pointed to Trump's past criticism of Acosta and CNN as “fake news.” “On its face,” Boutrous argued, “the government's action was content-based.” He added: “The content-based evidence is really overwhelming.”

Numerous media organizations, represented by Ballard Spahr, are backing CNN in its fight to restore Acosta's press credentials.

Read more: