After a testy exchange between the president and the reporter, the unidentified press aide went up to Acosta to take a microphone out of his hands. As a result, press secretary Sarah Sanders announced a few hours later that the White House had revoked Acosta’s “hard pass,” which enables reporters to enter and leave the grounds each day.

Sanders called Acosta’s alleged behavior “unacceptable” and cited Acosta’s encounter with the press aide as the basis for yanking his credential. She tweeted an apparently doctored video of the incident.

CNN filed suit in U.S. District Court in Washington. “We have asked this court for an immediate restraining order requiring the pass be returned to Jim, and will seek permanent relief as part of this process,” the network said in a statement released Tuesday morning.

Late Tuesday afternoon, the judge in the case, Timothy J. Kelly, ordered the White House and the other defendants to respond to CNN’s motion for a temporary restraining order by 11 a.m. Wednesday. He set a hearing on the restraining order — which would temporarily restore Acosta’s press credential, pending the outcome of a trial — for 3 p.m. Wednesday.

Legal experts say the network’s chances of winning in court are favorable. Although a court would probably give the president and Secret Service the benefit of the doubt if they barred a reporter due to security threats, the First Amendment protects journalists against arbitrary restrictions by government officials.

“I think it’s a really strong lawsuit,” Floyd Abrams, a noted First Amendment lawyer, told CNN on Sunday. “I think [CNN] should sue, and if it’s not about Acosta, this is going to happen again . . . So whether it’s CNN suing or the next company suing, someone’s going to have to bring a lawsuit, and whoever does is going to win” unless the White House can show that Acosta is violent and disruptive.

The suit names CNN and Acosta as plaintiffs. Trump, Chief of Staff John F. Kelly, Deputy Chief of Staff for Communications Bill Shine, Sanders and the U.S. Secret Service are named as defendants. It alleges a violation of the First Amendment, a violation of the Fifth Amendment, which guarantees due process in government actions, and a violation of the Administrative Procedure Act. It asks for the immediate restoration of Acosta’s credential, or restoration pending a hearing before a “neutral” arbiter.

In a defiant statement, Sanders called the suit “more grandstanding from CNN” and said the White House will “vigorously” defend itself.

“CNN, who has nearly 50 additional hard pass holders, and Mr. Acosta is no more or less special than any other media outlet or reporter with respect to the First Amendment,” she said.

She made no mention of a physical altercation between Acosta and the press aide — the original reason the White House cited for the suspension — and instead said the suspension was because Acosta would not yield to other reporters.

“After Mr. Acosta asked the president two questions — each of which the president answered — he physically refused to surrender a White House microphone to an intern, so that other reporters might ask their questions,” Sanders said. “This was not the first time this reporter has inappropriately refused to yield to other reporters . . . The First Amendment is not served when a single reporter, of more than 150 present, attempts to monopolize the floor.”

Disputes have occasionally flared over which members of the press corps are qualified to receive a “hard pass.” But Trump’s action appears to be unprecedented; there’s no record of a president revoking such a pass from a reporter because he didn’t like the questions the reporter asked.

During Lyndon Johnson’s presidency, the Secret Service denied a credential to reporter Robert Sherrill of the Nation magazine. The agency said Sherrill, who had been in a fistfight with one of Johnson’s campaign aides, was a physical threat to the president. Sherrill sued and eventually won in 1977, though he declined to apply for a pass afterward, according to journalist George Condon.

Another possible parallel: A federal judge last year struck down Trump’s blocking of critics on Twitter. She ruled that the First Amendment prevented him from denying access to presidential statements due to a would-be follower’s opinions and views.

“The government cannot exclude reporters from [the White House] because of their views,” said Jaffer. “Once the government created a general right of access it cannot selectively withdraw it based on viewpoint. Viewpoint is not a criterion that establishes a media organization’s right to be at a news briefing.”

CNN’s lawsuit, he added, “is critical to preserve the media’s ability to ask hard questions and hold the government accountable . . . It would be intolerable to let this kind of thing go unchallenged. Other reporters would end up hesitating before asking sharp questions, the White House would be able to use the threat of similar revocations for critical coverage, and media coverage of the White House would be distorted because of fear of official retaliation.”

Other journalists have been widely supportive of Acosta since Trump pushed him out last week. In a statement Tuesday, the White House Correspondents' Association’s president, Olivier Knox, said the organization “strongly supports” CNN in regaining its access. He said the revocation of Acosta’s credential was a “disproportionate reaction” to the news conference incident. “The president of the United States should not be in the business of arbitrarily picking the men and women who cover him,” Knox said.

Others have urged even stronger action in response to Trump’s retaliation against Acosta.

Richard Tofel, the president of ProPublica, the nonprofit investigative news organization, suggested in an interview that journalists band together and walk out of the White House press room.

“If favorable coverage is the price of operating within the [White House] gates, then we can cover it from outside the gates,” said Tofel, a lawyer who was once an intern in the White House press office. “I think that, as a matter of press freedom, the press corps in the room should say, ‘If you’ve redefined the rules to hand out passes only to those whose coverage you don’t object to, we’re all leaving.’ This isn’t principally a legal question. It’s a question of editorial independence.”

Deanna Paul contributed to this report.

Paul FarhiPaul Farhi is The Washington Post's media reporter. He started at The Post in 1988 and has been a financial reporter, a political reporter and a Style reporter. Follow