In 1978, I was asked to head the F.B.I. at a perilous time. The bureau was mired in controversy, stung by criticism over Watergate and warrantless wiretaps, beleaguered by congressional investigations. I took on the job because, as I said back then, “this institution was too important to lose.”

We worked hard to restore trust. Ronald Reagan later appointed me to do the same at the C.I.A. after the Iran-contra scandal. Having served my country through these challenging chapters in American history, I am saddened by what I see happening today to the investigation led by the special counsel, Robert Mueller. From President Trump’s tweets to broadsides from his lawyer, Rudolph Giuliani, denouncing the investigation, to calls from congressional Republicans for the ouster of Mr. Mueller’s boss, Rod Rosenstein, the deputy attorney general, it’s destructive.

I was disappointed to see Mr. Trump this week appear to express greater confidence in the word of President Vladimir Putin of Russia than in the unanimous judgment of the men and women of America’s intelligence community, whom I once led. Faith in the justice system and in our intelligence agencies cannot be collateral damage in a partisan grudge match. No matter which party wins, America loses; trust in the rule of law is always too important to lose. Sixty years ago, I was just one of many young Americans who enlisted and put on a uniform to defend America’s values in the world; today, we must defend those values here at home.

I’m a lifelong Republican. Mr. Giuliani was a fine federal prosecutor during the years I led the F.B.I. It is because he knows better that I expect him to do better than to demand that the Justice Department shut down an investigation into possible Russian interference in the 2016 election. That investigation has already led to 35 indictments — including those last week of 12 Russian intelligence officers in the hacking of the Democratic National Committee and the Hillary Clinton presidential campaign — as well as five guilty pleas and one prison sentence. To accuse Mr. Mueller of trying “to frame” Mr. Trump is wrong.