Roger Stone, a former campaign adviser for President Trump, leaves federal court in Washington on Feb. 1. (Pablo Martinez Monsivais/AP)

Republican operative and longtime Trump friend Roger Stone faced fresh legal trouble Friday after a federal judge ordered his attorneys to explain why they failed to tell her before now about the imminent publication of a book that could violate his gag order by potentially criticizing the judge or prosecutors with special counsel Robert S. Mueller III.

The order by U.S. District Judge Amy Berman Jackson of the District of Columbia late Friday came barely eight days after Jackson barred Stone from speaking publicly about his case, prompted by a photo posted on Stone’s Instagram account that placed a crosshairs next to a photo of Jackson’s head.

Stone apologized for abusing the court’s trust, asking for a second chance. Jackson said in imposing the gag order Feb. 21 that it would be “foolhardy” to wait for him to transgress again, that she had “serious doubts whether you’ve learned any lesson at all,” and warned she would order him to jail for future violations.

Stone, 66, is accused of lying to Congress and obstructing justice to cover up his efforts to gather information concerning hacked Democratic Party emails during the 2016 campaign.

He has pleaded not guilty. Prosecutors with Mueller and the U.S. attorney’s office of the District said separately Friday they expect a trial to take at least five to eight days.

In the new controversy, Jackson, in a brief order posted on the court’s electronic docket after office hours Friday, said she was allowing Stone’s defense team to file under seal a motion apparently to clarify the court’s gag order and an unspecified accompanying exhibit, and ordered a court clerk to make public Stone’s request.

But Jackson also ordered Stone’s attorneys to explain by Monday why they waited until now in making that request to disclose the “imminent general rel[e]ase” of a book, which Jackson said “was known to the defendant.”

Jackson said Stone’s attorneys could have told the court about the unidentified book either in a February court filing or the Feb. 21 hearing on whether she should impose a gag order to limit prejudicial pretrial publicity and ensure Stone’s right to a fair trial.

That was particularly so, she noted, because Stone’s defense attorney suggested at the hearing an appropriate gag order should provide that he “should not be talking about this Court. He should not be talking about the special prosecutor.”

She said Stone’s defense added, “this Court should not be criticized by Mr. Stone. The government should not be impugned by Mr. Stone. The integrity of this case should not be impugned by Mr. Stone.”

Stone attorney Bruce S. Rogow did not immediately respond to a request for comment.

On Jan. 16, Stone announced via Instagram that he would be publishing a book titled “The Myth of Russian Collusion: The Inside Story of How Trump Really Won.” He included an image of the book cover. At the time, a source familiar with the publication plans told The Washington Post that the book consisted of a new introduction attached to a previous book that Stone had written about the 2016 presidential campaign. On Feb. 15, he announced via Instagram that the book would be published March 1, and he accompanied the post with hashtags such as #noconspiracy and #norussiancollusion.

In apologizing for his earlier post, Stone said he did not mean to pose a threat and “had no malicious intention,” and added, “It was improper for me to criticize at all, I recognize that.”

The Instagram post solicited donations to Stone’s legal defense fund and said he faced a “show trial” in Jackson’s courtroom after his indictment stemming from the special counsel’s investigation of Russian interference in the 2016 election. The post referred to the special counsel as “Deep State hitman Mueller,” and the hashtag “#fixisin.”

Prosecutors said the post and Stone’s subsequent public comments threatened to taint the pool of potential jurors.

Under the gag order, Stone can continue to raise funds for his defense and speak on other matters.

Stone has been released on an unsecured personal recognizance bond and allowed to travel between South Florida, Washington and New York City. He was previously allowed to discuss the case publicly, just not in the immediate vicinity of the D.C. federal courthouse.

He was indicted in January on charges of obstructing justice, lying and witness tampering in what prosecutors said was an effort to hide repeated attempts to get information about plans to release the hacked Democratic emails. By itself, those actions may not constitute a crime, but authorities say Stone lied to Congress when asked about them.

U.S. officials say the stolen emails were hacked by Russian intelligence officers and then shared with others, including the global anti-secrecy group WikiLeaks, whose founder, Julian Assange, made them public.

According to the indictment, Stone contacted the group through an intermediary for information on the hacked emails at the direction of an unidentified senior Trump campaign official. He then allegedly lied to congressional staff investigators and encouraged another person to do the same, according to the court records.

Correction: This article has been corrected to show that quotes cited by Judge Amy Berman Jackson in her March 1 notice referred to comments made by a defense attorney for Roger Stone and did not come from a prosecutor, as the article had stated.