Washington • A federal judge on Friday barred longtime Donald Trump confidant Roger Stone from making public comments that could influence potential jurors in the criminal case brought by the special counsel in the Russia probe.

U.S. District Judge Amy Berman Jackson said the gag order was necessary to ensure Stone’s right to a fair trial and “to maintain the dignity and seriousness of the courthouse and these proceedings.” The order is narrowly tailored to comments about his pending case and does not constrain Stone from discussing other topics publicly.

The ruling, which applies to Stone and lawyers on both sides in the case, comes after a string of media appearances by the attention-seeking political consultant since his indictment and arrest last month. In several of those interviews, Stone had blasted special counsel Robert Mueller's investigation into Russian election interference as politically motivated and criticized his case as involving only "process crimes."

Jackson had cited those media appearances in raising the prospect of a gag order, warning Stone at a hearing not to treat his case like a “book tour.”

Lawyers for Stone had argued that any limits on his public comments would infringe on his First Amendment right to free speech. They wrote in a filing last week that Stone’s comments wouldn’t merit a “clear and present danger to a fair trial.” Mueller’s prosecutors had said they wouldn’t oppose a gag order.

In her order, Jackson said she considered not only the potential impact of public comments on jurors but also the need to maintain order at the federal courthouse in Washington.

Citing the "size and vociferousness" of crowds already attracted to Stone's court proceedings, Jackson barred Stone, lawyers and witnesses from making any statements to the news media while entering and exiting the courthouse. She left open the possibility that she could amend the order in the future and reminded Stone that he is not allowed to contact any witnesses in the case.

The 66-year-old Stone was arrested in an FBI raid at his Fort Lauderdale, Florida, home last month. He has pleaded not guilty to charges of lying to Congress, obstruction and witness tampering. The charges stem from conversations he had during the 2016 election about WikiLeaks, the anti-secrecy group that released material stolen from Democratic groups, including Hillary Clinton's campaign.

U.S. intelligence agencies have said that Russia was the source of the hacked material, and last year Mueller charged 12 Russian intelligence officers in the hacking. But Stone is not accused of directly coordinating with WikiLeaks.

Stone has been outspoken since immediately after his arrest, declaring his innocence in a press conference following his court appearance in Florida and accusing Mueller of heavy-handed tactics by having him arrested in a pre-dawn raid of his home.

He's been more muted outside the courthouse in Washington, though he did hold a news conference — accompanied by a host from the conspiracy theory website InfoWars — in which he said he would respect any gag issued by the judge but also expected to appeal it. Among his lawyers is a noted First Amendment attorney who represented the rap group 2 Live Crew in an obscenity court about 30 years ago.

He maintained he had no negative information about the president to share with Mueller and insisted he hadn't done anything wrong.