IT’S FAIR to doubt that President Trump fired FBI Director James B. Comey because of his handling of the Hillary Clinton email investigation — a performance the president had previously praised . But whatever his motive, Mr. Trump has removed an independent official overseeing inquiries into Russia’s intervention in last year’s election, from which the president benefited, and Moscow’s possible collaboration with elements of Mr. Trump’s campaign. The firing has undermined the credibility of a vital national security investigation. The priority for Congress and the Justice Department must be to restore independence and credibility to that probe as quickly as possible.

First the country must have a full accounting of Mr. Comey’s dismissal— before Congress confirms a new FBI director. Did, as some reports suggest, Mr. Trump trigger a search for a pretext to dismiss the director because of his anger over Mr. Comey’s statements about the Russia case? Did Rod J. Rosenstein, the heretofore reputable deputy attorney general, knowingly or unwittingly cooperate with such a charade? Before any nominee is confirmed, the White House must forswear any interference in the FBI investigation and promise to provide it with all needed resources. The New York Times reported Wednesday that Mr. Comey asked for more resources for the Russia investigation in the days leading up to his termination, suggesting the inquiry was far from over. A Justice Department spokesperson denied the report. Even so, Congress must ensure that the FBI gets the resources it requires.

But no White House pledge can repair the damage of Mr. Comey’s firing, nor satisfy the preexisting need for a full understanding of the foreign attack the U.S. democratic system endured last year. Any Trump FBI nominee would be tainted by association with the president, and the episode has also raised questions about the independence of the Justice Department’s highest officials. These considerations have led Democrats to demand a special prosecutor to oversee the Russia investigation, chosen by a career Justice Department official, rather than Mr. Rosenstein or any other political appointee. That, along with the nomination of a qualified and politically independent new FBI director, would help reestablish credibility.

Much of the burden for cleaning up this mess falls on Congress. Reactions from Republican lawmakers to the Comey news ranged from appropriate alarm and concern to unsettling acceptance. The current House and Senate investigations of Russia have produced some valuable testimony, but many lawmakers have proved themselves incapable of separating politics from the important work their committees are supposed to be conducting. It’s now obvious that Congress should empanel an independent commission to fully investigate Moscow’s hacking attacks and any Russian links to Mr. Trump and his campaign. The goal should be not merely to determine if anyone should be charged with a crime, but also to develop a complete picture of Russian capabilities and intentions, as well as recommendations for mounting a defense of U.S. democracy.