FBI Director James Comey said Wednesday that he had no choice but to tell Congress that the FBI reopened its investigation into Hillary Clinton’s email server just two weeks before the election — and suggested he had no regrets about doing so even though he acknowledged it may have impacted the outcome.

Testifying in front of the Senate Judiciary Committee, Comey argued that not sending the letter would have “destroyed” the FBI’s reputation because it would look like the bureau was trying to cover up potentially important new information to protect a political candidate.

“I sat there that morning, and I could not see a door labeled ‘no action,’” Comey told Sen. Dianne Feinstein (D-CA), who had asked for an explanation of the bureau’s controversial decision. (Comey’s letter to Congress would soon be leaked to the press, upending the 2016 election.)

Quite a moment: Maybe the most animated you'll ever see Comey, defending himself on making Oct. Clinton announcement https://t.co/IwWVADEJ2f — Bradd Jaffy (@BraddJaffy) May 3, 2017

Clinton and many of her supporters believe Comey’s decision swung the election. Speaking at a high-profile event in New York Tuesday, Clinton blamed her loss on Comey and a concerted Russian effort to harm her candidacy and help Trump.

“I was on the way to winning until the combination of Jim Comey’s letter on October 28, and Russian WikiLeaks raised doubts in the minds of people who were inclined to vote for me but got scared off — and the evidence for that intervening event is, I think, compelling [and] persuasive,” she said.

Democrats aren’t the only ones who believe Comey made a historic mistake. Critics from both parties note that senior Justice Department officials explicitly warned him against taking any steps that could impact the outcome of an impending election. The department’s inspector general is currently investigating whether Comey behaved appropriately, an extraordinary move that means the nation’s top cop is himself in law enforcement crosshairs.

Comey, unsurprisingly, sees things very differently. Speaking to the Senate panel Wednesday, he said that the investigative team that determined in July 2016 that Clinton hadn’t broken a law came to him with information about new records discovered on the laptop of Anthony Weiner, the estranged husband of Clinton aide Huma Abedin.

Comey explained what happened next:

I saw two doors: One was labeled “speak,” and the other was labeled “conceal.” Because here’s how I thought about it — I’m not trying to talk you into it, but I want you to know my thinking. Having repeatedly told this Congress, “We are done; there’s nothing there; there’s no case there; there’s no case there,” to restart in a significant way and not speak about it would require an act of concealment, in my view. So I stared at speak or conceal. Speak would be really bad — lordy, there’s an election in 11 days. Concealing, in my view, would be catastrophic — not just to the FBI but well beyond. And between “really bad” and “catastrophic,” we’ve got to look into the world of “really bad.” We have to tell Congress we’re restarting this. ... Look, this was terrible. 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.

Even while giving his testimony, Comey appeared to recognize that his answer wouldn’t satisfy Clinton supporters, or those who wonder why he broke with department protocol in not publicly commenting on investigations.

Critics were quick to point out that the FBI did not disclose the details of its investigation into possible ties between the Trump campaign and Russia, which US intelligence agencies had been probing for months before the November vote. And there’s little doubt that the letter wound up jolting a race that was only decided by a few thousand votes in the Rust Belt.

But Comey ended with what appeared to be a recognition that reasonable people could find that he had erred.

“I could be wrong,” he said. “This has been one of the world’s most painful decisions.”