Kelly, whom Trump appointed to the federal bench last year, handed down his ruling two days after the network and government lawyers argued over whether the president had the power to exclude a reporter from the White House.
In his decision, Kelly ruled that Acosta's First Amendment rights overruled the White House's right to have orderly news conferences. Kelly said he agreed with the government's argument that there was no First Amendment right to come onto the White House grounds. But, he said, once the White House opened up the grounds to reporters, the First Amendment applied.
He also agreed with CNN's argument that the White House did not provide due process. He said the White House's decision-making was "so shrouded in mystery that the government could not tell me. ... who made the decision." The White House's later written arguments for banning Acosta were belated and weren't sufficient to satisfy due process, Kelly said.
CNN issued a statement after the ruling saying, "We are gratified with this result and we look forward to a full resolution in the coming days. Our sincere thanks to all who have supported not just CNN, but a free, strong and independent American press."Acosta added: "I just want to thank all my colleagues in the press who supported me this week. I want to thank the judge (for this ruling). And let's go back to work."
White House press secretary Sarah Sanders announced Acosta's "indefinite" suspension last week after the confrontation at the news conference. Trump and Sanders have had several run-ins with Acosta stretching back to before Trump became president.
Acosta watched Friday's proceedings from the courtroom in Washington, joined by a team of attorneys including Ted Olson, a former solicitor general in George W. Bush's administration, and Ted Boutrous, a star litigator and media-law specialist.
CNN has argued that the ban on Acosta violated his First Amendment rights because it amounts to "viewpoint discrimination" - that is, the president is punishing him for statements and coverage he didn't like. The network has also said the action violates Acosta's Fifth Amendment right to due process because his exclusion follows no written guidelines or rules and has no appeal or review procedures.
CNN had requested "emergency" relief from the judge, arguing that Acosta's rights were being violated with each passing hour.
Until the White House's action last week, no reporter credentialed to cover the president had ever had a press pass revoked.
A government lawyer, James Burnham, argued in a hearing before Kelly on Wednesday that the president was within his rights to ban any reporter from the White House at any time, just as he excludes reporters from interviews in the Oval Office. He said Acosta could report on the president "just as effectively" by watching the president on TV or by calling sources within the White House. He also said CNN wouldn't be injured by Acosta's exclusion since CNN has dozens of other journalists credentialed for the White House.
Burnham also explained that Trump's rationale for Acosta's ban was his "rudeness" at last week's news conference, in effect arguing that Acosta's conduct, not his right to free speech, was the relevant issue.
The assertions drew a rebuttal from CNN's lawyer, Boutrous, who described the ban on the reporter as arbitrary, capricious and unprecedented. He said White House reporters need access to the premises to meet with sources and to report on untelevised "gaggles," impromptu discussions with press aides and other officials, so that banning a reporter from the grounds harms his or her ability to do their job.
Media organisations have been alarmed by the White House's treatment of Acosta, saying that revoking his "hard pass" to enter the White House is a threat to other journalists who might be similarly banned. Trump has suggested other reporters could face a similar fate if they displease him in some unspecified way. Thirteen news organisations, including the Washington Post and Fox News, said Wednesday they would jointly file a friend-of-the-court brief supporting CNN's position.
The White House Correspondents Association, which represents journalists in negotiations over access to the president, filed its own brief on Thursday that urged the court "to roundly reject the president's dangerous legal position." It disputed the government's claim that the president has "absolute, unbridled discretion to decide who can report from inside the White House."
During the presidential campaign in 2015 and 2016, Trump banned more than a dozen news organisations from his rallies and public events, including The Post. But he said he wouldn't do something similar as president. Last week, he went back on that statement.
Trump's 2020 re-election campaign has used the CNN lawsuit to drum up contributions, portraying the suit as evidence of "liberal bias" - an assertion Boutrous brought up on Wednesday to demonstrate that Trump had political reasons for banning Acosta.
"CNN is SUING President Trump, Sarah Huckabee Sanders, a Secret Service agent, and other White House officials ..." the fundraising email says. "... All because they REVOKED Jim Acosta's press badge after his continuous grandstanding and inappropriate refusal to yield to other reporters.
"President Trump will NOT put up with the media's liberal bias and utter disrespect for this Administration and the hardworking Americans who stand with us."