A federal judge ordered the White House to restore CNN reporter Jim Acosta’s press pass, ruling Friday that President Trump and his aides didn’t give Mr. Acosta enough of a chance to explain himself or contest the revocation.

The ruling is a major win for CNN and its combative approach to the Trump White House.

Judge Timothy J. Kelly, ruling from the bench, said the facts of last week’s encounter that led to the press credential being withdrawn were in doubt, and said that’s all the more reason why the White House should have given Mr. Acosta a chance to explain himself.

“The opportunity to be heard seems especially important in this case,” he said. “The government must provide Mr. Acosta due process if it is to revoke his hard pass.”

Mr. Acosta’s credentials were stripped after a press conference in which he verbally sparred with the president, then got into an altercation with a White House intern who came to end his questioning.

When the intern came to take the microphone from him, Mr. Acosta refused to give it back, using his hand to chop at the woman’s elbow to prevent her from controlling the microphone.

CNN sued on Tuesday, saying revoking Mr. Acosta’s credentials was a violation of First Amendment press rights, Fifth Amendment due process rights and the Administration Procedure Act, which prohibits arbitrary decision-making.

The White House called the lawsuit “grandstanding” and said CNN has nearly 50 other journalists who can cover the White House, and Mr. Acosta’s access is not critical to the cause of press freedom.

But the judge disagreed, saying the fact CNN has other reporters doesn’t lessen the harm inflicted on Mr. Acosta.

The White House may have an interest in controlling its press facility, the judge noted, but he said a violation of constitutional rights is contrary to the public interest.

Judge Kelly also said once the White House opens part of its facilities to the press, a reporter’s constitutional rights are at stake.

The case had turned into a Rorschach test for Americans and how they view the press in the Trump era, with partisans picking sides on Twitter.

Inside the courtroom, Fox News, the Associated Press and many other news organizations sided with CNN, saying the White House cannot be allowed to use the threat of access to pressure reporters.

But One America News Network, a conservative upstart, filed a brief arguing it was Mr. Acosta who was hurting the press with rude questions.

Judge Kelly did not rule on the big First Amendment questions CNN raised, instead limiting his decision to whether the White House had acted arbitrarily in denying Mr. Acosta a thing of value — in this case, the press pass that CNN says is crucial to him doing his job.

The judge relied on a 1977 case from the federal appeals court in Washington, D.C., where judges ruled the Secret Service couldn’t deny a press pass to a reporter in an arbitrary way — without notice or an opportunity to rebut — potentially violating the 5th Amendment’s right to due process.

“I have no choice but to apply that precedent here,” the judge ruled.

He added that Sarah Huckabee Sanders, the White House press secretary, issued a written statement about the revocation only after the litigation had been brought.

But Ms. Sanders, responding to the ruling Friday, said there must be “decorum at the White House.”

“In response to the court, we will temporarily reinstate the reporter’s hard pass,” she said. “We will also further develop rules and processes to ensure fair and orderly press conferences in the future.”

The president echoed the need for decorum hours after the ruling, telling reporters they can’t stand up and ask three or four questions while refusing to sit down.

“We want total freedom of the press. … we’re setting up a certain standard which is what the court is requesting,” he said. “With the rules and regulations, we will end up back in court and we will win.”

In a statement, CNN and Mr. Acosta thanked the judge and said they were looking forward to a full resolution.

Our sincere thanks to all who have supported not just CNN, but a free, strong and independent American press,” it read.

After leaving the courtroom, Mr. Acosta said it’s time to get back to work.

“I want to thank all of my colleagues in the press who supported us this week,” Mr. Acosta told reporters.

Later on the White House grounds, Mr. Acosta was greeted by a throng of about 50 journalists awaiting his arrival. He said he was “very grateful” for the outcome of the court case.

“Honestly guys, it’s just any other day at the White House for me,” he said. “I want to get back to work. And so should you.”

He stressed that journalists need to understand their First Amendment rights are “sacred.”

“I was confident … that our rights would be protected to continue to cover our government and hold our leaders accountable,” he said.

• Dave Boyer and Gabriella Muñoz contributed to this story.

Sign up for Daily Newsletters Manage Newsletters

Copyright © 2020 The Washington Times, LLC. Click here for reprint permission.