The ruling was an initial victory for CNN in its lawsuit against President Trump and several top aides.

The lawsuit alleges that CNN and Acosta's First and Fifth Amendment rights are being violated by the suspension of Acosta's press pass.

Kelly did not rule on the underlying case on Friday. But he granted CNN's request for a temporary restraining order.

This result means that Acosta will have his access to the White House restored for at least a short period of time. The judge said while explaining his decision that he believes that CNN and Acosta are likely to prevail in the case overall.

Kelly made his ruling on the basis of CNN and Acosta's Fifth Amendment claims, saying the White House did not provide Acosta with the due process required to legally revoke his press pass.

He left open the possibility, however, that the White House could seek to revoke it again if it provided that due process, emphasizing the "very limited" nature of his ruling and saying he was not making a judgment on the First Amendment claims that CNN and Acosta have made.

Kelly was appointed to the bench by Trump last year, and confirmed with bipartisan support in the Senate.

CNN has also asked for "permanent relief," meaning a declaration from the judge that Trump's revocation of Acosta's press pass was unconstitutional. This legal conclusion could protect other reporters from retaliation by the administration.

"The revocation of Acosta's credentials is only the beginning," CNN's lawsuit alleged, pointing out that Trump has threatened to strip others' press passes too.

That is one of the reasons why most of the country's major news organizations have backed CNN's lawsuit, turning this into an important test of press freedom.

But the judge will rule on all of that later. Further hearings are likely to take place in the next few weeks, according to CNN's lawyers.

The White House took the unprecedented step of suspending Acosta's access after he had a combative exchange with Trump at last week's post-midterms press conference. CNN privately sought a resolution for several days before filing suit on Tuesday.

The defendants include Trump, press secretary Sarah Sanders, and chief of staff John Kelly.

Kelly, a Trump appointee who has been on the federal bench just more than a year now, was very inquisitive at Wednesday's hearing, asking tough questions of both sides, drilling particularly deep into some of CNN's arguments.

In public, the White House continued to argue that Acosta deserves to be blacklisted because he was too aggressive at the press conference.

Speaking with Robert Costa at a Washington Post Live event on Thursday, White House communications official Mercedes Schlapp said press conferences have a "certain decorum," and suggested that Acosta violated that. "In that particular incident, we weren't going to tolerate the bad behavior of this one reporter," she said. Schlapp repeated the "bad behavior" claim several times.

When Costa asked if the White House is considering yanking other press passes. Schlapp said "I'm not going to get into any internal deliberations that are happening."

In court on Wednesday, Justice Department lawyer James Burnham argued
that the Trump White House has the legal right to kick out any reporter at any time for any reason -- a position that is a dramatic break from decades of tradition.

While responding to a hypothetical from Kelly, Burnham said that it would be perfectly legal for the White House to revoke a journalist's press pass if it didn't agree with their reporting. "As a matter of law... yes," he said.

The White House Correspondents' Association -- which represents reporters from scores of different outlets -- said the government's stance is "wrong" and "dangerous."

"Simply stated," the association's lawyers wrote in a brief on Thursday, "if the President were to have the absolute discretion to strip a correspondent of a hard pass, the chilling effect would be severe and the First Amendment protections afforded journalists to gather and report news on the activities on the President would be largely eviscerated."