A federal judge ruled in favor of CNN on Friday, allowing the network’s star reporter Jim Acosta to temporarily regain access to his White House press credential.

"I will grant the application for the temporary restraining order. I order the government reinstate the pass," U.S. District Judge Timothy J. Kelly ruled from Washington.

Kelly – who rescheduled Thursday’s planned hearing for Friday morning – heard lengthy oral arguments earlier in the week about the cable news network’s request for a temporary restraining order and preliminary injunction. The administration had suspended Acosta's "hard pass," which provided expedited access to the White House grounds.

White House Press Secretary Sarah Sanders issued the following statement: “Today, the court made clear that there is no absolute First Amendment right to access the White House. 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.”

Kelly’s decision is temporary and further hearings are expected to take place in the next few weeks to determine whether or not yanking the credential violated CNN's and Acosta’s First and Fifth Amendment rights. The temporary order lasts for 14 days and CNN can now petition the Court for a permanent injunction.

“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,” CNN said in a statement.

As President Donald Trump points to CNN's Jim Acosta, a White House aide tries to take the microphone from him during a news conference in the East Room of the White House, Wednesday, Nov. 7, 2018, in Washington. (AP Photo/Evan Vucci)

The judge, a Trump appointee, declared that precedent had been set that the White House should have given Acosta due process before taking away his credential and that harm to the reporter had already occurred. He said that CNN is likely to succeed on Fifth Amendment grounds and that the harm to Acosta outweighs the government's need for an orderly press conference.

“I want to thank all of my colleagues in the press who supported us this week and I want to thank the judge for the decision he made today. Let’s go back to work,” Acosta said outside the U.S. District Court.

Acosta's press pass to access the White House was suspended last week "until further notice" after he engaged in a contentious back-and-forth with President Trump during a press conference. Acosta refused to pass the microphone to a female White House aide and there was brief contact between the two. Later in the day, Acosta’s credential was revoked.

CNN filed the federal lawsuit against the Trump administration on Tuesday demanding that the White House restore the press credential of the star reporter -- but Sanders called the move “more grandstanding from CNN.”

CNN's Jim Acosta questions U.S. President Donald Trump during his news conference following Tuesday's midterm U.S. congressional elections at the White House in Washington, U.S., November 7, 2018. REUTERS/Jonathan Ernst - RC189F0AFAA0

The Trump administration countered the motion, saying Acosta “disrupted the fair and orderly administration of a press conference” when he refused to give up the microphone. Judge Kelly dismissed the Trump administration’s claim that CNN could simply send another reporter in Acosta’s place and told attorneys to file additional court papers in the case by Monday.

Trump addressed the situation himself, demanding decorum, on Thursday after signing a cybersecurity and infrastructure bill.

“You have to practice decorum,” Trump said. “We want total freedom of the press, that’s very important to me... but you have to act with respect, you’re in the White House.”

Earlier this week, Fox News announced that it would support CNN’s effort to restore Acosta’s White House credential and filed an amicus brief with the U.S. District Court.

“Fox News supports CNN in its legal effort to regain its White House reporter’s press credential. We intend to file an amicus brief with the U.S. District Court. Secret Service passes for working White House journalists should never be weaponized. 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,” Fox News President Jay Wallace said in a statement.

Acosta has emerged as a hero of the #Resistance after making a habit of shouting and interrupting when Trump and members of his administration are available to the media. Acosta has also gotten into combative arguments with other members of the administration, including former Press Secretary Sean Spicer, Management and Budget Director Mick Mulvaney and Senior Policy Adviser Stephen Miller.

The Associated Press contributed to this report.