WASHINGTON — In dramatically casting aside James B. Comey, President Trump fired the man who may have helped make him president — and the man who potentially most threatened the future of his presidency.

Not since Watergate has a president dismissed the person leading an investigation bearing on him, and Mr. Trump’s decision late Tuesday afternoon drew instant comparisons to the “Saturday Night Massacre” in October 1973, when President Richard M. Nixon ordered the firing of Archibald Cox, the special prosecutor looking into the so-called third-rate burglary that would eventually bring Nixon down.

In his letter firing Mr. Comey, the F.B.I. director, Mr. Trump made a point of noting that Mr. Comey had three times told the president that he was not under investigation, Mr. Trump’s way of pre-emptively denying that his action was self-interested. But in fact, he had plenty at stake, given that Mr. Comey had said publicly that the bureau was investigating Russia’s meddling in last year’s presidential election and whether any associates of Mr. Trump’s campaign were coordinating with Moscow.