Former FBI director James B. Comey, who was subpoenaed by two House committees, has agreed to appear voluntarily Friday before the House Judiciary Committee. (Clodagh Kilcoyne/Reuters)

Former FBI director James B. Comey will appear voluntarily Friday before the House Judiciary Committee, which has agreed to withdraw a subpoena, Comey’s attorney said Sunday.

In a three-paragraph joint court filing Sunday, Comey’s lawyers also withdrew his request to a federal judge to quash the subpoena to testify before the House judiciary and oversight committees, writing, “Mr. Comey appreciates the Court’s attention to the above-captioned matter, but has now reached an acceptable accommodation with U.S. House of Representatives Committee on the Judiciary for voluntary testimony.”

Lawyers for the House consented to Comey’s move to drop the case.

Comey agreed to sit for a voluntary interview on Friday under terms that include that “so long as the interview proceeds as a voluntary interview, an FBI representative will be present to advise concerning the disclosure of FBI information,” said his lawyer David N. Kelley.

After an initial hearing on the challenge Friday, U.S. District Judge Trevor N. McFadden did not rule but indicated he was unlikely to grant Comey’s motion. Both sides were due to return Monday before McFadden.

Comey filed suit to fight a subpoena issued jointly last week by the two committees “not to avoid giving testimony but to prevent the Joint Committee from using the pretext of a closed interview to peddle a distorted, partisan political narrative about the Clinton and Russian investigations.”

Kelley cited what he said were numerous leaks that distorted what witnesses said in closed session before the committees as the reason for the challenge.

During Friday’s court session, Thomas G. Hungar, the general counsel for the Judiciary Committee, said Comey would be free to speak to reporters after his Hill appearance and to release a transcript, something that is typically available within a day.

In a tweet Sunday, Comey referred to those in-court statements and said “this is the closest I can get to public testimony.”

Kelley had told the court that a closed committee appearance would create “a shadow on the witness but bright lights for the committee member who seeks partisan advantage by peddling a misleading account of the witness’s testimony.”

But Hungar told the judge that Comey had been subpoenaed for a deposition, not a full committee hearing, and that depositions are always closed, whether in Congress or in civil suits around the country. He said they are typically attended by staff and lawyers, and maybe a few members.

The Judiciary and Oversight committees jointly subpoenaed Comey and former attorney general Loretta E. Lynch more than a week ago to appear for a closed-door deposition to discuss the politically charged FBI investigations into both Russian interference in the 2016 election and the email practices of former secretary of state Hillary Clinton.

Comey said he was willing to testify publicly but not behind closed doors.

Comey was due to appear Monday on the Hill, but Kelley disclosed in court that a new subpoena changed the deposition date to Tuesday.

In a Sunday morning appearance on Fox News Channel’s “Sunday Morning Futures,” House Judiciary Committee Chairman Bob Goodlatte (R-Va.) previewed Comey’s move, telling host Maria Bartiromo that he expected Comey would withdraw his motion.

“The counsel for the House and the counsel for Mr. Comey have been working cooperatively, and I expect that will happen. If it doesn’t, there is a hearing set tomorrow morning. . . . I think that the strength of the presentation made by Tom Hungar, the House counsel, on Friday in the House’s brief is very compelling, and I think that that is where the parties are headed in their discussions right now,” Goodlatte said.

McFadden in court Friday noted House lawyers had cited a 1975 Supreme Court ruling, which invoked the speech or debate clause of the Constitution, granting members of Congress immunity from civil suits, or arrest, while performing their duties.