Andrew Miller, a former aide to Roger Stone, will testify Friday before the grand jury used by special counsel Robert S. Mueller III in his investigation of Russian interference in the 2016 election, a federal judge ordered Wednesday.

Miller, 34, for 10 months waged an ultimately losing battle to quash a grand jury subpoena and faced jail time for contempt if he continued to refuse to testify.

In court, his attorney and a prosecutor said Miller would answer prosecutors’ questions about Stone’s activities since 2016 — including what work or services Stone asked him to perform since the election — but did not give more details during the open segment of a partially sealed court hearing.

Miller’s agreement to testify came during the same hour Wednesday that Mueller publicly announced the closing of the special counsel’s office and his resignation from the Justice Department.

The grand jury that worked with Mueller continues to hear testimony in ongoing matters related to Mueller’s now-concluded investigation, and a number of cases charged in the probe — including Stone’s — have been handed off to local federal prosecutors, including in Washington.

Miller, of St. Louis, was on speakerphone Wednesday for the hearing at which U.S. District Chief Judge Beryl A. Howell denied a last-ditch motion by Miller’s attorney, Paul D. Kamenar, to block his client’s grand jury appearance.

Kamenar argued it is an abuse of grand jury process for prosecutors to seek pretrial testimony from a witness about a subject who has already been indicted, also noting that Mueller has issued his final report.

Stone, a longtime confidant of President Trump’s, was indicted in January on charges of lying to Congress, witness tampering and obstructing justice regarding his efforts to obtain information at the behest of Trump’s campaign about the hacking and public release of Democratic Party emails. He has pleaded not guilty.

Howell said it was long-settled law that prosecutors can properly obtain grand jury testimony to develop additional charges against an indicted target, or to investigate individuals not yet facing charges. Prosecutors can also use evidence against Stone in his pending November trial if it was collected incidentally and not the primary focus of Miller’s questioning, she said.

“The government is not abusing the grand jury process in this case, and the government has need of Mr. Miller’s testimony,” Howell ruled from the bench, upholding her August contempt finding when Miller failed to testify.

“If Mr. Miller does not appear before the grand jury on Friday, he will be in contempt and there will be an arrest warrant issued for him. Do you understand, Mr. Miller?” Howell asked.

“Yes, your honor,” Miller answered over speakerphone.

Prosecutors told the judge in a sealed bench conversation about the ongoing matters in which they seek Miller’s help, but not before Kamenar said that in a May 6 email prosecutors confirmed that one question would regard “what work he did for Stone from 2016 on.”

Miller worked for the GOP operative during the 2016 presidential campaign, handling duties such as setting up media interviews, and has been an assistant to Stone for about a decade.

He was one of at least a half-dozen of Stone’s associates called to testify last year before Stone was indicted.

Mueller has alleged Russian intelligence operatives stole the emails in the first half of 2016 and disseminated them before the fall election via the anti-secrecy group WikiLeaks, led by Julian Assange, and other entities that U.S. prosecutors have said were online fronts invented by Russian agents. Stone testified to the House Intelligence Committee in September 2017.

Stone is expected back in court Thursday, when his attorneys will argue motions to dismiss charges.

Miller’s testimony was sought by Justice Department attorneys Aaron S.J. Zelinsky, formerly with Mueller’s team, and Jonathan I. Kravis, an assistant U.S. attorney for the District. Zelinsky is a special assistant U.S. attorney for the District for Stone’s case but is based with the U.S. attorney’s office for Maryland.

At Wednesday’s hearing, Kamenar and Zelinsky continued to dicker over the details as they stood before the judge.

“May I just say, this case has been pending 10 months,” Howell finally broke in, exasperated, adding that the U.S. Circuit Court of Appeals for the D.C. Circuit had given a week’s notice that it would formally reject Miller’s appeal Tuesday.

“You all need to have this length of conversation to decide how you’re going to proceed?” Howell said. Kamenar and Zelinsky then said Miller agreed to testify Friday before the grand jury.

The federal grand jury in Washington that worked with Mueller is set to end its two-year term on July 5, when unanswered subpoenas would expire.