WASHINGTON (AP) — A federal judge on Friday placed some limits on what longtime Donald Trump confidant Roger Stone and his lawyers can say publicly about his criminal case brought by the special counsel in the Russia probe.

But U.S. District Judge Amy Berman Jackson stopped short of imposing a broad ban on public comments by the outspoken political operative, issuing a limited gag order she said 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 bars Stone from making comments about his pending case near the courthouse but it does not constrain him from making other public statements about his case. It does generally bar his lawyers, prosecutors and witnesses from making public comments that could "pose a substantial likelihood" of prejudicing potential jurors.

Jackson's order also 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.

Jackson 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. She also said if Stone complained about pre-trial publicity at a later date, she would consider whether he had brought it on himself.

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 is not accused of directly coordinating with WikiLeaks. But Mueller's team did confirm in a court filing Friday that investigators have evidence of communication between Stone and WikiLeaks and between Stone and Guccifer 2.0, who purported to be a Romanian hacker responsible for the intrusions but who authorities say was actually a Russian agent.

Mueller did not provide details of the communications, though The Atlantic last year published what it said were Twitter direct messages between Stone and WikiLeaks, including one in which WikiLeaks appeared to scold Stone for suggesting in his public comments an association with the organization.

The messages that have been made public were exchanged after WikiLeaks had begun already releasing the hacked material, and they don't show Stone coordinating with the anti-secrecy group.

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.

"I am not accused of Russian collusion, I am not accused of collaboration with WikiLeaks, I am not accused of conspiracy," Stone said. "There is no evidence or accusation that I knew in advance about the source or content of the WikiLeaks material."