The J. Edgar Hoover Building, headquarters of the FBI, in Washington. (Photo by Astrid Riecken for The Washington Post)
Tim Weiner's reporting and writing on national security have won the Pulitzer Prize and the National Book Award. He is the author of “Enemies: A History of the FBI” and “Legacy of Ashes: The History of the CIA.”

President Trump can’t fire the FBI.

Minutes before ridding himself of Attorney General Jeff Sessions on Wednesday, Trump answered a question about the Russia investigation at a White House news conference: “I could end it right now. I could say, ‘That investigation is over.’ ”

He could try.

He could order Sessions’s acting replacement, Matthew G. Whitaker, who has mused wistfully about stifling the investigation by Robert S. Mueller III, to play the role of political assassin. He could direct Whitaker to cut the special counsel’s budget to zero. He could tell him to limit the inquiry’s scope. He could try to oust Mueller and to make sure his investigative report never sees the light of day. He could fire the FBI director, Christopher Wray — just as he fired the previous director, James Comey, last year — and put a political puppet in his place.

He could do any or all of these things, as politically foolhardy and constitutionally perilous as they might seem, while the Republicans who control the Senate look on and do nothing.

But short of sending tanks down Pennsylvania Avenue and blowing the J. Edgar Hoover Building to smithereens, Trump cannot stop the FBI. No commander in chief ever has, not before Hoover died 46 years ago, and certainly not since.

The 21st-century FBI, for all its flaws, has escaped the darkness of Hoover’s shadow, a legacy of warrantless wiretapping and vengeful attacks against the director’s enemies. It is in great part the creation of Mueller, who ran it from 2001 to 2013. It is decidedly not a political tool to be manipulated by presidents. It is as independent as a hog on ice — once launched, it has a mind of its own. I’ve been convinced of this while working on a five-hour documentary about how the FBI has confronted presidents who violated their oath of office. (“Enemies ” debuts Nov. 18 on Showtime.) The FBI has faced down five commanders in chief who threatened to run the ship of state aground: in the Watergate scandal, in the Iran-contra imbroglio, in the Monica Lewinsky affair, in the matter of post-9/11 spying on Americans and in its criminal investigation of the Trump team. Its record isn’t perfect, but it has by and large upheld the rule of law.

In no case was a president able to disrupt or derail an FBI investigation. In every case, the bureau preserved evidence, pursued facts and persevered. The truth is that the FBI has the power to say no to presidents, but presidents can’t easily say no to the FBI.

Presidents have been caught bending and even breaking the bounds set by their oath of office to protect and defend the Constitution. The bureau can check them with its immense investigative force, which gives it the ability to execute subpoenas and seize records inside the West Wing, to reveal the deepest secrets and expose the boldest lies: “I’m not a crook.” “We did not — repeat, did not — trade weapons or anything else for hostages.” “I did not have sexual relations with that woman. ” The FBI proved these presidential statements false.

The FBI can’t thwart Trump’s long train of abuses against the Constitution, common sense and common decency. But in time — since neither can Trump cavalierly counteract the momentum of the evidence accumulating against him and his close confidants — it may establish that he is a common crook.

President George W. Bush couldn’t stop Mueller, then the FBI director, from compelling him to scale back his illegal eavesdropping on Americans. “I am forced to withdraw the FBI from participation in the program,” Mueller wrote in a letter he carried to the White House in 2004. If the president did not back down, “I would be constrained to resign as Director of the FBI.” (Senior Justice Department officials, including Comey and, lest we forget, Wray, also threatened to resign in protest.) Bush backed down.

President Bill Clinton couldn’t stop the FBI from drawing blood from his arm; the DNA evidence proved he had lied under oath about his sex life. That led directly to his impeachment.

President Ronald Reagan couldn’t stop the FBI from raiding the National Security Council’s offices, where agents found proof that the United States had sold weapons to Iran and skimmed the profits to finance the Central American counterrevolutionaries known as the contras, aid that Congress had expressly forbidden. The bureau’s work resulted in the indictments of 12 top national security officials. President George H.W. Bush pardoned the Iran-contra gang, but a law-breaking administration had been caught red-handed and brought to heel by the FBI.

Not even Richard Nixon could stop the G-men. God knows he tried. Trump is no student of history, but he would do well to recall Nixon’s battle with the bureau.

When Hoover died in May 1972 — six weeks before the Watergate break-in — Nixon installed a politically loyal stooge, L. Patrick Gray, in his place. “You’ve got to be a conspirator,” Nixon counseled Gray. “You’ve got to be totally ruthless.” Nixon tried to sabotage the FBI as soon as it started looking into the break-in, ordering the CIA to obstruct the bureau’s investigation, on spurious national security grounds. Gray destroyed devastating evidence linking the White House to the Watergate burglars. But to a man, the FBI agents on the case fought furiously against Gray’s attempts to undermine them.

Five leakers at high levels of the bureau made sure word got out. These included not only Associate Director Mark Felt, a.k.a. “Deep Throat,” but the head of the Washington field office, the supervisor who kept the running chronology of the case, and the chief and the lead agent of the white-collar-crime division. “They would meet at the end of the day and discuss what happened, what they knew, in the investigation,” Paul Daly, an intelligence division agent, said in an FBI oral history. “They would make a decision, a conscious decision, to leak to the newspapers. They did that because of the White House obstructing the investigation.”

Defying the president, his attorney general and the FBI director, they followed the evidence that made Nixon an unindicted co-conspirator in the obstruction of justice — and sent the men who had served as his campaign manager, attorney general, chief of staff and counsel to prison.

Nixon fired the Watergate special prosecutor and got rid of the attorney general and his deputy, who stood in the way of his wrath. It was all in vain. Though many despaired in the immediate wake of this “Saturday Night Massacre” — the special prosecutor’s spokesman said he was going home to read up on the Reichstag fire — a new special prosecutor went to work, and a new attorney general supported him. The wheels of justice rolled on.

Trump may be counting on Whitaker to be his ruthless executioner. The acting attorney general should take care not to become the president’s co-conspirator in any obstruction of justice. Mueller’s grand jury might judge him harshly.

If Trump follows Nixon down the road to hell, the FBI will be on the case. As Asha Rangappa, a former FBI counterintelligence agent, recently wrote in the New York Times, “To ‘shut down’ the investigation at this point would require not just a face-off with Mr. Mueller but also with special agents in charge of multiple field offices with a vested interest in seeing their responsibilities through.” Trump may fight the law, but the law will win in the end.

The FBI has been toiling on this investigation for almost 18 months. It has the power to pore over the president’s tax returns and his business records. It has proved, through the guilty plea of Trump’s fixer, Michael Cohen, that his hush-money payoffs broke campaign finance laws. Cohen knows the inner workings of the Trump Organization. Paul Manafort knows a great deal about the 2016 Trump campaign, which he ran during and after the Republican National Convention. The government may reveal the extent of their cooperation at their imminent sentencings. Trump cannot derail investigations and prosecutions that may arise from their revelations.

FBI agents have gathered a mountain of evidence for Mueller and for U.S. attorneys in Washington, New York and Virginia. They know a lot about Trump that we do not know. And that evidence can be preserved on flash drives that cannot be deleted by presidential edict — or shredded by criminal enablers.

Trump could fire the federal prosecutors — but others would replace them. And under the law, Mueller can be fired only for “good cause,” such as legal misconduct or a conflict of interest. There is no such cause, despite the president’s baseless assertions that the investigators are politically biased.

Even if Whitaker tries to deep-six the special counsel’s report, the underlying facts cannot be erased. The report will not be easily sealed and suppressed. Democrats in Congress will use subpoena power to try to lay hands on it. They can certainly call Mueller as a witness.

The FBI and Mueller already have established through indictments and convictions that members of Trump’s team (and Vladi­mir Putin’s) participated in a wide-ranging conspiracy to “obstruct the lawful functions of the United States government through fraud and deceit.” The statute at the root of the investigation — 18 USC 371 — covers violations of tax laws and election laws, witness tampering, money laundering and obstruction of justice. Trump potentially has criminal exposure on at least some of these fronts. And if that catches up to him while he is in office, he has only one clear way out: He can pardon himself. That would abrogate the ancient rule of law holding that no one can be his own judge and jury. Even his lawyer, Rudolph W. Giuliani, has called that idea “unthinkable.”

A Justice Department guideline holds that a sitting president cannot be indicted. And so Trump may serve out his time in office untouched by the long arm of the law, unruffled by the prospect of a Senate trial on impeachment, untroubled by the threat of indictment. Citizen Trump, by contrast, may face considerable peril.

His “enemies,” as Nixon once described any who got in his lawless way, may hold a sliver of hope that someday public servants with the FBI emblem on their backs will visit Trump in one of his gilded palaces and bring him to justice.

Read more from Outlook:

Moderate Republicans aren’t dead. They’re hiding in plain sight.

Five myths about cable news

Follow our updates on Facebook and Twitter.