James Comey agrees to testify before House on condition it be made public afterward

The former FBI director had filed suit last week to block a subpoena.

“Hard to protect my rights without being in contempt, which I don’t believe in. So [I] will sit in the dark, but Republicans agree I’m free to talk when done and transcript released in 24 hours. This is the closest I can get to public testimony,” Comey wrote on Twitter Sunday morning.

Comey has agreed to testify on Friday behind closed doors, according to a committee aide.

Comey had filed suit in federal court Thursday to block the subpoena requiring him to testify behind closed doors to the House Judiciary and Oversight Committees, instead preferring to testify publicly. In the lawsuit, the former FBI director condemned the process as being powered by “a poisonous combination of presidential tweets and the selective leaking that has become standard practice" for Republican lawmakers.

Republican lawmakers want one more opportunity before handing control of the House to Democrats to push both Comey and former Attorney General Loretta Lynch on their handling of the FBI’s investigation into former Secretary of State and Democratic presidential candidate Hillary Clinton’s use of a private email server and their separate probe into Russian interference in the 2016 presidential election.

"Mr. Comey asks this Court’s intervention not to avoid giving testimony but to prevent the [panel] from using the pretext of a closed interview to peddle a distorted, partisan political narrative about the Clinton and Russian investigations through selective leaks," read Comey's challenge to the subpoena, filed Thursday in U.S. District Court for the District of Columbia.

Comey also expressed gratitude to U.S. Circuit Court Judge Trevor McFadden, an appointee of President Donald Trump, who was expected to make a formal ruling Monday.

In a tweet Thursday, House Judiciary Committee Chairman Bob Goodlatte, R-Virginia, called Comey’s lawsuit “baseless.”

“It appears Mr. Comey believes he deserves special treatment, as he is the only witness refusing to either appear voluntarily or comply with a subpoena,” Goodlatte wrote.

Comey has received a subpoena from the Republican-led House Judiciary Committee before. In 2016, after the then-FBI director announced the agency would not recommend seeking charges for Clinton’s use of a private email server.

Comey has also previously testified on Capitol Hill about both the Clinton and Russia investigations.

Trump fired Comey last year on the grounds that Comey had mishandled the Clinton case, with both then-Attorney General Jeff Sessions and Deputy Attorney General Rod Rosenstein sending memos expressing agreement with the decision.

ABC News' Mike Levine, Ben Siegel and MaryAlice Parks contributed to this report.