Updated at 1:13 p.m. ET
A federal judge in Washington, D.C., delivered a blow to President Trump Friday, ruling in favor of CNN and the news media.
Judge Timothy Kelly, a Trump appointee, ordered the White House to restore correspondent Jim Acosta's press credentials, something the White House said later it would do.
"Each day he [Acosta] is deprived ... [he] suffers a harm that cannot be remedied in retrospect," Kelly said.
This is not the end of the road in this fight, however. The judge also said the White House needs to establish standardized rules if it wants to try to justify taking away a pass from a reporter covering the White House. He said he wants to hear from both sides again Tuesday to determine the way forward.
This order was granted on a limited basis and on Fifth Amendment grounds. The judge said the White House denied Acosta's right to due process under the law. The judge avoided ruling on First Amendment grounds, focusing instead on the arbitrariness of the White House's decision.
Whatever process occurred to take Acosta's pass away is "shrouded in mystery," Kelly said.
White House press secretary Sarah Sanders later said Acosta's credential would be restored and will create a more standardized set of rules.
"Today, the court made clear that there is no absolute First Amendment right to access the White House," Sanders said. "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."
Shortly after Sanders' statement, Trump told reporters: "We're writing up rules and regulations. ... We have to practice decorum. We want total freedom of the press. ... We're setting up a certain standard which is what the court is requesting."
Acosta took to the microphones outside the D.C. courthouse earlier.
"I want to thank all of my colleagues in the press who supported us this week," he said, and he thanked the judge for the decision he made. "Let's get back to work."
CNN attorney Ted Boutrous called it a "great day for the First Amendment and for journalism" (although the First Amendment was not applied here).
The White House Correspondents' Association also released a statement in support of the judge's decision.
"The White House Correspondents' Association welcomes today's ruling, in which a federal judge made it clear that the White House cannot arbitrarily revoke a White House press pass," said Olivier Knox, president of the association. "We thank all of the news outlets and individual reporters who stood up in recent days for the vital role a free and independent news media plays in our republic."
It's very possible the White House drops the case and instead comes up with some level of varying standards that could again be challenged by the press in court. The next steps remain to be seen.
The lawsuit follows the Trump administration's decision last week to withdraw White House press credentials from Acosta after he and Trump had a testy exchange during a news conference on Nov. 7. The suit sought the immediate restoration of Acosta's press pass, arguing on First Amendment grounds that the White House action was aimed at silencing the journalist.
CNN was joined by other news media organizations, which saw high stakes in the case that could cede a degree of editorial control to the White House and threaten the ability of a free press to be a check on presidential power.
The Trump administration argued that the president has broad discretion to strip any reporter of White House press credentials if he wishes. It argued that the standard should be whether the reporter was "disorderly," "rude" or "grandstanding."
CNN's lawyers argued that sometimes democracy is "unpleasant" but having a free press is one of the ways democracies hold governments accountable.
Under questioning from the judge in arguments Wednesday, Deputy Assistant Attorney General James Burnham, who made the case for the administration, conceded that he knew of no other case in which a president had revoked a reporter's White House credentials.
Kelly noted that there have been plenty of contentious, unrelenting journalists covering presidents through the years — and none had ever been stripped of their ability to cover the White House.
The judge also pressed CNN's attorneys, noting that there were plenty of other CNN journalists covering the White House.
Boutrous argued that the Trump administration's views on the First Amendment are "warped" and that there's no First Amendment doctrine that says, "Because there are lots of other reporters you can ban one."
Trump has gone so far as to call journalists the "enemy of the people" and, at his rallies, crowds frequently break into chants of "CNN Sucks" as he routinely brands as "fake news" any coverage he deems unflattering.
In particular, he has been enraged at the media for not giving him more positive coverage after winning the 2016 presidential election.
"The press treats me terribly," he told Lesley Stahl on CBS's 60 Minutes. "I thought very strongly that, you know, the one great thing will happen is the press will start treating me great [once he won the presidency]. Lesley, they treat me worse. They got worse instead of better. Very dishonest. ... I regret that the press treats me so badly."