After a nearly year-long subpoena battle, a former aide to longtime Trump adviser Roger Stone is expected to appear before a grand jury in D.C. on Friday.

Andrew Miller, a former adviser to Stone, was directed by a judge in D.C. to appear before the grand jury after a lengthy legal battle to resist providing testimony.

“Andrew will be here Friday morning to testify before the grand jury and will cooperate,” Miller's attorney Paul Kamenar told ABC News in an interview on Wednesday.

The road that ended in Chief Judge Beryl Howell ordering Miller to finally testify this week has been several months in the making, ABC News has learned.

A judge filed a civil contempt order against Miller last August following his failure to the original subpoena compelling him to testify before Mueller’s grand jury last July.

Mueller's prosecutors initially sought Miller's testimony while investigating Stone, who was indicted in January as part of the special counsel's probe. Stone was charged with seven counts which include obstruction, witness tampering and making false statement. He's scheduled to stand trial in D.C. in November.

Miller, who had previously turned over documents to prosecutors and been offered limited immunity for his testimony, has waged several legal battles in his effort to resist testifying. However, federal and appeals court judges have continued to uphold the mandate Miller testify before Mueller’s grand jury during each of the various attempts by Miller’s lawyer to reverse it.

Meanwhile, behind the scenes, Kamenar and former prosecutor Aaron Zelinksky – who was part of Mueller’s prosecutorial team during the probe and has stayed on the Stone case – have been trading emails in recent months. Kamenar described some of the exchanges to ABC News, which included Zelinksy offering the option of Miller coming in to interview with him first and, depending on the proffer session, then determine whether a grand jury testimony was still necessary, according to Kamenar.

In one of their exchanges, Zelinsky told Kamenar that prosecutors want to ask Miller about work he did for Stone from 2016 to present.

Miller had served as an aide to Stone, who has described Miller as his “wingman” because he helped manage Stone’s schedule, media appearances and offered other assistance to him around the 2016 Republican National Convention. He also started and handles Stone's website "StoneZone.Com."

On Tuesday, the case was officially punted from the court of appeals and put on Judge Howell’s desk under seal. In a closed hearing on Wednesday that was unexpectedly opened to public, Kamenar argued that the order upholding the subpoena compelling Miller to testify was an abuse by prosecutors of the grand jury because Stone had already been indicted – and you cannot use a grand jury during prosecution – and because special counsel Mueller completed his investigation.

However, two exceptions to that rule exist: The prosecution can still use a grand jury to question a witness after a target is indicted if prosecutors want to charge the person with other crimes, or if there are other targets the prosecution wants to go after. Zelinsky declined to reveal which of the two applies in Miller’s case.

Speaking on the sidelines in the courtroom today, Kamenar told ABC News that Zelinksy doubled-down on his offer for Miller to meet with him for a proffer on Monday first, and then Zelinsky would determine if a grand jury testimony Tuesday was needed or not. Kamenar elected that his client go directly for grand jury testimony, and Judge Howell ordered Miller to appear Friday.

Kamenar told ABC News he is not asking for any redactions to his filing and exhibits in the currently sealed case – materials which Judge Howell ordered this afternoon for the defense and prosecution to make necessary redactions to by 5 pm Wednesday before the case documents are made public.