(CNN) FBI Director James Comey is testifying before Congress Wednesday, and received several sharp questions on his decision to alert Congress just days before the election that his agency was investigating emails on Anthony Weiner's laptop that were potentially related to a probe of Hillary Clinton's use of a private server.

The emails did not ultimately end up changing the outcome of the FBI's investigation, but days later Clinton lost the presidential election to Donald Trump.

Clinton -- as recently as Tuesday -- blamed Comey's letter to Congress in part for why she lost, and other Democrats have also criticized Comey's input.

Below is a CNN transcription of the exchange:

FEINSTEIN: Why was it necessary to announce 11 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: Great question, Senator, thank you. (On) October 27, the investigative team that had finished the investigation in July focused on Secretary Clinton's emails asked to meet with me. So I met with them that morning, late morning in my conference room and they laid out for me what they could see from the metadata on this fella (former congressman) Anthony Weiner's laptop that had been seized in an unrelated case.

What they could see from the metadata was that there were thousands of Secretary Clinton's emails on that device including what they thought might be the missing emails from her first three months as secretary of state. We never found any emails from her first three months. She was using a Verizon Blackberry then and that's obviously very important because if there was evidence that she was acting with bad intent, that's where it would be.

FEINSTEIN: But they weren't there.

COMEY: Can I just finish my answer, senator? And so they came in and said we can see thousands of emails from the Clinton email domain including many, many, many from the Verizon Clinton domain, Blackberry domain. They said we think we gotta get a search warrant to go get these and the Department of Justice agreed. We had to go get a search warrant. So I agreed. I authorized them to seek a search warrant.

And then I faced a choice. 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 dogcatcher election or President of the United States. But I sat there that morning and I could not see a door labeled 'no action' here. I could see two doors and they were both actions. One was labeled 'speak' and the other was labeled 'conceal.' 'Cause here's how I thought about it. I'm not trying to talk you into this. But I want you to know my thinking.

Having repeatedly told this Congress we're done and there's nothing there, there's no case there, there's no case there, to restart in a hugely significant way, potentially finding the emails that would reflect on her intent from the beginning and not speak about it would require an act of concealment in my view. And so I stared at speak and conceal. Speak would be really bad. There's an election in 11 days. Lordy, that would be really bad. Concealing in my view would be catastrophic not just to the FBI 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 that we're restarting this not in some frivolous way, in a hugely significant way.

And the team also told me we cannot finish this work before the election and then they worked night after night after night and they found thousands of new emails, they found classified info on Anthony Weiner('s computer). Somehow her emails were being forwarded to Anthony Weiner including classified information by (Clinton's) assistant, Huma Abedin, and so they found thousands of new emails and called me the Saturday night before the election and said thanks to the wizardry of our technology we've only had to personally read 6,000. We think we can finish tomorrow morning, Sunday.

And so I met with them and they said we found a lot of new stuff. We did not find anything that changes our view of her intent. So we're in the same place we were in July, it hasn't changed our view, and I asked them lots of questions and I said okay if that's where you are then I also have to tell Congress that we're done.

Look, this was terrible. It makes me mildly nauseous to think that we 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? And I could be wrong but we honestly made a decision between those two choices that even in hindsight and this has been one of the world's most painful experiences, I would make the same decision. I would not conceal that on October 28 from the Congress.

And I sent a letter to Congress, by the way people forget this, I didn't make a public announcement, I sent a private letter to the chairs and the rankings of the oversight committees.

(Grumbling, cross-talk by Feinstein)

COMEY: I know it's a distinction without a difference in the world of leaks but it is, it was very important that I tell them instead of concealing and reasonable people can disagree but that's the reason I made that choice. And it was a hard choice. I still believe in retrospect the right choice, as painful as this has been. And I'm sorry for the long answer.