James Comey attacks GOP and Trump in challenge to House subpoena Republicans want to press the former FBI director on several issues.

Lawyers for former FBI Director James Comey have filed suit in federal court, challenging a congressional subpoena that demands he testify behind closed doors to a House panel allegedly powered by "a poisonous combination of presidential tweets and the selective leaking that has become standard practice" for Republican lawmakers.

Before Republicans on the House Judiciary Committee and House Oversight Committee hand control over to Democrats in January, they want to press Comey -- and former Attorney General Loretta Lynch -- on the FBI's investigation into Hillary Clinton's use of a private email server and the FBI's subsequent probe of Russian meddling 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," reads Comey's challenge to the subpoena, filed Thursday in U.S. District Court for the District of Columbia.

Last week, after first receiving the subpoena, Comey tweeted: "Happy Thanksgiving. Got a subpoena from House Republicans. I'm still happy to sit in the light and answer all questions. But I will resist a 'closed door' thing because I’ve seen enough of their selective leaking and distortion."

The lawsuit filed by Comey's lawyers on Thursday accuses Republicans of pushing a "corrosive narrative" that Clinton "committed serious crimes and was given unwarranted leniency by an FBI and DOJ that were loyal to her and her party, and that Trump has, by contrast, been saddled with unwarranted scrutiny, for purely partisan political reasons, by that same FBI and DOJ."

What's more, the lawsuit alleges, the "poisonous combination" of "selective" leaks and tweets from Trump "appears to be to mislead the public and to undermine public confidence in the FBI and the DOJ during a time when President Trump and members of his administration and campaign team are reported to be under investigation by Special Counsel Robert Mueller and other law enforcement authorities."

According to the lawsuit, "The public record shows members of the Joint Committees leaking what suits them and maintaining the secrecy only of what does not," and that selective leaking has done "grievous harm" to "public discourse on matters of grave national concern." The lawsuit accuses lawmakers of selectively leaking information related to closed-door testimony from several former officials, including former FBI deputy director Andrew McCabe and former FBI agent Peter Strzok, who was fired from the agency for sending anti-Trump text messages to a colleague.

"To be clear, the FBI and DOJ are appropriately subject to congressional oversight," and lawmakers are investigating "appropriate subjects," the lawsuit says, but "Mr. Comey should not be coerced into participating in an improper and partisan effort to undermine the legitimacy of an institution that he served for the better part of four years."

"There is no legitimate reason" for Comey to testify privately, and the subpoena violates House rules and "harasses the witness," the lawsuit concludes.

The suit notes that federal courts have previously intervened in the conduct of congressional investigations, insisting "judicial intervention" is "warranted" in this case.

In a tweet late Thursday, the chairman of the House Judiciary Committee, Rep. 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 said.

Last week, Comey's attorney David N. Kelley said in a statement that the subpoena for a "closed door interview" was a break from established norms.

"Mr. Comey embraces and welcomes a hearing open to the public, but the subpoena issued yesterday represents an abuse of process, a divergence from House rules and its presumption of transparency," the statement said.

Trump fired Comey last year, insisting Comey had mishandled the Clinton-related case. In memos sent to Trump before Comey's firing, Deputy Attorney General Rod Rosenstein and then-Attorney General Jeff Sessions agreed.

After Comey's lawsuit was filed, spokespeople for the congressional committees did not immediately respond to requests seeking comment for this article.

--ABC News' Ben Siegel and MaryAlice Parks contributed to this report.