A federal judge on Friday ruled to immediately reinstate CNN reporter Jim Acosta’s White House press credentials in a victory for the cable news network and the media outlets that are supporting its lawsuit.

CNN’s victory was in response to a temporary restraining order asking for the immediate restoration of Acosta’s press pass. Its broader lawsuit concerns whether the White House’s decision to revoke his press pass was unconstitutional.

U.S. District Judge Timothy J. Kelly, who was appointed by President Donald Trump last year, said CNN’s attorneys were likely to prevail in their argument that the White House had violated Acosta’s and the network’s First and Fifth Amendment rights.

Kelly said he did not decide whether the White House violated the First Amendment, relying primarily on the Fifth Amendment in saying that Acosta’s and CNN’s right to due process was likely violated because the White House process for revoking his press pass was “shrouded in mystery.”

The judge also cited the “irreparable harm” to Acosta. The White House had argued that CNN could simply send other reporters in Acosta’s place, yet Kelly argued that it “does not make the harm to Mr. Acosta any less real.”

Under the ruling, Acosta will temporarily receive his press pass back, while the full lawsuit proceeds.

“We are gratified with this result and we look forward to a full resolution in the coming days,” CNN said in a statement. “Our sincere thanks to all who have supported not just CNN, but a free, strong and independent American press.”

White House press secretary Sarah Huckabee Sanders said Friday that the White House “will temporarily reinstate the reporter’s hard pass.”

But in a statement, she also appeared to view the temporary ruling as a victory: “Today, the court made clear that there is no absolute First Amendment right to access the White House.”

Sanders added that “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.”

Trump also told reporters at the White House: “We want total freedom of the press. It’s more important to me than anybody would believe. But you have to act with respect when you’re at the White House.”

CNN on Tuesday sued the Trump administration for confiscating Acosta’s “hard pass,” which grants White House press pool reporters access to the White House, following a spat between the president and Acosta during a post-midterm elections press conference last week.

In a hearing in federal court on Wednesday, Justice Department attorney James Burnham said the president has the authority to ban reporters from the White House, The Washington Post reported.

Burnham also argued that Acosta can continue reporting on the Trump administration from outside the White House and noted that CNN has other reporters with White House credentials.

Shannon Finney via Getty Images A judge ruled in favor of CNN and reporter Jim Acosta.

In response, CNN attorney Ted Boutrous said the government had a “warped view” of the First and Fifth amendments.

“The government’s now taking the position that [the president] can do anything he wants,” Boutrous said, according to the Post.

After Acosta challenged Trump with questions on his anti-immigration rhetoric and the federal Russia investigation last week, Trump demanded Acosta sit down and called him a “terrible person” and “enemy of the people.”

During the exchange, Acosta also moved away when a female intern tried to take away the microphone he was using. The White House suspended Acosta’s credentials hours after the press conference, citing his behavior toward Trump and the intern.

Kelly on Friday seemed unpersuaded, calling the White House’s initial justification “of questionable accuracy” and “likely untrue.”

The White House later shifted its story to claim that Acosta was rude to reporters.

A group of prominent news organizations have expressed support for CNN’s lawsuit, including CNN competitor Fox News, which frequently provides favorable news coverage of Trump.

In a statement on Wednesday, Fox News President Jay Wallace said the network would file an amicus brief in favor of CNN’s “legal effort” with the U.S. District Court in Washington.

“Secret Service passes for working White House journalists should never be weaponized,” Wallace said in the statement.

“While we don’t condone the growing antagonistic tone by both the President and the press at recent media avails, we do support a free press, access and open exchanges for the American people,” he added.

The Washington Post, The New York Times, NBC News and The Associated Press also backed CNN’s lawsuit.

This story has been updated with more details on the ruling and reaction from the White House and Trump.