Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

U.S. District Judge Amy Berman Jackson cautioned longtime Donald Trump confidant Roger Stone on Friday that she had already seen a significant amount of publicity in his criminal case before her. The judge warned Stone not to turn his prosecution into a public relations campaign, and suggested she may issue a gag order in the case.

The judge has already issued an order preventing Stone from providing information to the media. On Friday, Jackson granted a protective order barring the defense from sharing discovery disclosed by the government with anyone not authorized by the court to receive these materials.

This kind of order is allowed under a a federal court rule that authorizes the judge to restrict discovery for good cause shown. If a party defies that order, the same rule allows the court to “enter any … order that is just under the circumstances," which can include sanctions.

Notwithstanding this current order restricting the defense from passing on documents to the media or unauthorized people, the judge may also enter another order restricting publicity, under a different rule. A District of Columbia local court rule restricts the flow of information from court personnel, attorneys and the parties themselves.

This court recently entered a similar order in another high-profile case: the criminal prosecution of Paul Manafort. In his case before Jackson, the court ordered all parties—but particularly the attorneys—to refrain from making public statements or comments to the media that were “substantially likely to have a materially prejudicial effect on this case.”

Manafort’s lawyers, like all defense attorneys, have special access to information through discovery and client communications. Sometimes a defense attorney’s extrajudicial statements can, as Jackson put it, “pose a threat to the fairness of a pending prosecution.”

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

That same local rule that allowed Jackson to “gag” Manafort’s attorneys allows the court to “gag” Roger Stone, the defendant.

In a sensational or heavily publicized case, a federal court can issue a special order restricting extrajudicial statements by parties, witnesses and attorneys that are likely to interfere with the right to a fair trial by an impartial jury.

The limitations are designed to avoid comments likely to influence the outcome of the trial and comments that are likely to prejudice the jury venire.

A gag order restraining the speech of trial participants may feel like a violation of the First Amendment. But gag orders under this court rule are constitutional as long as they are properly justified. Most courts have required that pretrial publicity pose a “reasonable likelihood” of prejudicing the right to a fair trial before entering a gag order.

Other courts have stricter standards; they will not issue such an order unless there is a clear or serious threat to the fairness of the trial, and nothing short of a gag order would effectively mitigate the damage.

As long as Jackson can articulate a reasonable likelihood that extrajudicial statements could threaten Stone’s fair trial rights, the court can enter an order gagging Roger Stone.

If it does enter such an order, Stone might just violate it anyway.

Despite the sound advice of his attorneys to comply with all court orders, Stone may make a strategic decision to violate the ones that restrict his public statements.

Stone may conclude that publicly disseminating information or making extrajudicial statements is worth the risk of getting caught violating a protective, or gag, order. Stone has made a lucrative career out of manipulating public perception. He knows how to do it, and he knows how to get results as a “dirty trickster." Why should his own criminal trial be any different?

To Stone, if he can surreptitiously control the narrative, he may be able to eke out an underdog win against a prosecutorial team that is a heavy favorite against him. Influencing his own trial on his own terms may prove too alluring, despite the broad authority of the court to punish him for defying it.

Danny Cevallos is an MSNBC legal analyst. Follow @CevallosLaw on Twitter.