When James Comey, the director of the F.B.I., testified before the Senate Judiciary Committee on Wednesday, Senator Dianne Feinstein, the ranking minority member of the committee, got right down to business—forcing Comey to explain his decision to insert himself into last November’s election. “Why was it necessary,” she asked him, “to announce, eleven days before a Presidential election, that you were opening an investigation on a new computer without any knowledge of what was in that computer? Why didn’t you just do the investigation as you would normally, with no public announcement?”

Comey seemed pretty relaxed. In his opening statement, he had said how much he loved his job. “Yes, great question, Senator, thank you,” he replied to Feinstein. “October 27, the investigative team that had finished the investigation in July focussed on Senator Clinton’s e-mails asked to meet with me.”

Comey recalled how he and the investigators discussed the discovery of what appeared to be thousands of Hillary Clinton’s e-mails on a laptop belonging to Anthony Weiner, the disgraced former congressman who was married to Clinton’s aide Huma Abedin. The F.B.I. had seized the laptop in a separate investigation of Weiner’s contact with an underage girl. But the investigators thought e-mails on the computer might include some from Clinton’s first three months as Secretary of State that they had been unable to locate during the initial investigation, Comey said, and this was important because, “if there was evidence that she was acting with bad intent, that’s where it would be, in the first three months.”

Comey said he then authorized his staff to get a warrant to examine the device. “And then I faced a choice,” he went on, speaking rapidly. “And I have lived my entire career by the tradition that if you can possibly avoid it, you avoid any action in the run-up to an election that might have an impact, whether it’s a dog-catcher election or President of the United States. But, as I sat there that morning, I could not see a door labelled ‘no action here.’ I could see two doors, and they were both actions. One was labelled ‘speak’ and the other was labelled ‘conceal.’ ”

In June, Comey had announced publicly that the investigation into Clinton’s use of a private e-mail server while Secretary of State was over, and that, although the agency concluded that Clinton and her aides had been “extremely careless” in their handling of classified information, it wasn’t recommending any criminal charges. To restart the investigation, by examining the e-mails on Weiner’s computer, and not speak about it publicly would “require an act of concealment, in my view,” Comey said. “And so I stared at ‘speak’ and ‘conceal.’ ‘Speak’ would be really bad. There’s an election in eleven days. Lordy, that would be really bad. Concealing, in my view, would be catastrophic. Not just to the F.B.I. but well beyond. And, honestly, as between really bad and catastrophic, I said to my team, ‘We’ve got to walk into the world of really bad. I’ve got to tell Congress we are restarting this.’ ”

Comey insisted that, if he had to do things over again, he would make the same decision. “Look, this was terrible,” he said. “It makes me mildly nauseous to think that we might have had some impact on the election, but, honestly, it wouldn’t change the decision. Everybody who disagrees with me has to come back to October 28 with me, and stare at this and tell me what you would do. Would you speak or would you conceal?”

Feinstein didn’t answer that question directly, perhaps because she suspected that it had been carefully constructed to rationalize Comey’s actions. Clearly, the e-mails found on the Weiner laptop put the F.B.I. director, who has a reputation for being a straight shooter, in a horrible spot. But trying to avoid the appearance of interfering with political matters isn’t merely a “tradition” at the F.B.I. As the Clinton campaign and a number of former Justice Department officials pointed out last October, there are official rules and guidelines instructing prosecutors and law-enforcement officials not to bring sensitive cases, or make any public comments about such cases, close to elections.

Why did Comey choose to overlook these guidelines? Did he fear that the news about restarting the Clinton investigation would leak before the election anyway? In one of his answers on Wednesday, Comey implied that he had reason to suspect that someone in the F.B.I.’s New York office might have been leaking material to Rudy Giuliani and others. It is also likely that, in October, Comey assumed that Clinton would win, and he feared the wrath of Republicans in Congress if it turned out that the F.B.I. had got its hands on damaging material about her before the election and failed to disclose it. “You took an enormous gamble,” Feinstein, the senior Democratic senator from California, noted. “The gamble was that there was something there that would invalidate her candidacy. And there wasn’t.”

Feinstein also asked Comey if there was any conflict among his staff about the decision to inform Congress. Comey conceded that a junior lawyer had asked him whether it might help Donald Trump get elected. “I said, ‘Thank you for raising that,’ ” Comey went on. “Not for a moment. Because down that path lies the death of the F.B.I. as an independent institution in America. I can’t consider for a second whose political fortunes will be affected in what way. We have to ask ourselves, What is the right thing to do? And then do that thing.”

Which was all very well, and reassuring. But it raised the obvious question of why Comey didn’t also inform Congress that the F.B.I. was investigating whether people connected to Trump’s campaign had secretly colluded with Russia. To be sure, whether Clinton mishandled classified information is a significant issue. But it hardly rises to the level of treachery or treason.

It was left to Patrick Leahy, the senior Democratic senator from Vermont, to press Comey on this. Leahy pointed out that, in the Clinton case, the F.B.I. had even released internal agency memos and interview notes. “I may have missed this, but in my forty-two years here, I have never seen anything like that,” Leahy said. “But you said absolutely nothing regarding the investigation into the Trump campaign’s relation to Russia’s illegal effort to help elect Donald Trump. Was it appropriate for you to comment on one investigation repeatedly and not say anything about the other?”

“I think so,” Comey replied. He said he had treated “both investigations consistently, under the same principles.” The F.B.I. didn’t confirm the existence of the Clinton investigation until three months after it started, he said, even though it had begun with a public referral, and the agency didn’t say anything else about it until the probe was completed. Turning to the Trump investigation, Comey added, “We didn’t say a word about it until months into it. . . . I would expect we are not going to say another peep about it until we are done.”

Stated in these terms, the argument seemed defensible. But, as with Comey’s two-door metaphor, the way he framed things may have been somewhat self-serving. According to some reports, it was last spring when U.S. intelligence agencies and law-enforcement agencies began looking into the contacts between members of Trump’s campaign and people associated with the Russian government. If that’s true, by October the investigation had been proceeding for more than three months. And yet Comey didn’t confirm its existence until March of this year.

Perhaps there were legitimate reasons for this delay. Presumably, he didn’t want to tip off the targets of the inquiry. But that, in itself, would indicate that there is some leeway in timing these types of announcements—the sort of leeway that Comey refused to grant himself last October.