A U.S. judge on Friday ordered the White House to temporarily restore CNN correspondent Jim Acosta's press pass, which was revoked after a contentious news conference last week with President Donald Trump.
The White House withdrew Acosta's credentials on Nov. 7 in an escalation of the Republican president's attacks on news organizations, who he has called enemies of the people.
U.S. District Judge Timothy Kelly, who is hearing CNN's lawsuit challenging the revocation, said Acosta's credentials must be restored while the network's case is pending.
White House Press Secretary Sarah Sanders said in a statement that Acosta's credentials would be temporarily restored.
"Let's go back to work," Acosta said to reporters after the hearing.
But Trump said that "people have to behave" and warned of future court action against reporters who do not.
"If they don't listen to the rules and regulations, we'll end up back in court and we'll win," Trump said on Friday. "But more importantly, we'll just leave. And then you won't be very happy, because we do get good ratings."
CNN said in a statement on Friday that it "looked forward to a full resolution in the coming days."
The Justice Department was "disappointed" with the court decision, spokeswoman Kelly Laco said in a statement.
"The president has broad authority to regulate access to the White House ... We look forward to continuing to defend the White House's lawful actions," Laco said.
In its lawsuit filed on Tuesday in U.S. District Court in Washington, CNN said the White House violated the First Amendment right to free speech, as well as the due process clause of the Constitution providing fair treatment through judicial process. The network asked for a temporary restraining order.
Judge Kelly, a Trump appointee, did not address the First Amendment's protections for freedom of speech and the press, focusing instead on the due process provision.
"Whatever process occurred within the government is still so shrouded in mystery that the government at oral argument could not tell me who made the initial decision to revoke Mr. Acosta's press pass," Kelly said in his verbal ruling.
In court, U.S. government lawyers said there was no First Amendment right of access to the White House and that Acosta was penalized for acting rudely at the conference and not for his criticisms of the president.
The judge said Sanders' initial statement that Acosta was penalized for touching a White House staffer attempting to remove his microphone was "likely untrue and at least partly based on evidence that was of questionable accuracy."
The day after the Nov. 6 congressional elections, Trump erupted into anger during the news conference when Acosta questioned him about the Russia probe and a migrant caravan traveling through Mexico.
"That's enough, that's enough," Trump told Acosta, as a White House staffer attempted to take the microphone away from the correspondent. "You are a rude, terrible person."
Sanders had accused Acosta of "placing his hands on a young woman just trying to do her job as a White House intern" and of preventing other reporters from asking questions. She called his behavior "absolutely unacceptable."
Videos of the encounter show Acosta pulling back as the staffer moved to take the microphone.
On Friday, Sanders said the White House "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."