FBI Director James Comey said he thought had no choice but to go to Congress about Hillary Clinton's emails days ahead of the election, he said in a Senate oversight meeting where he faced grilling from both parties on Wednesday.

In a hearing before the Senate Judiciary Committee on Wednesday, Comey reflected on the decision that is widely perceived to have played a major role in Donald Trump's election to the presidency.

"I sat there that morning and I could not see a door labeled, 'No Action,' here," he said of his thought process the day FBI investigators brought to his attention a new batch of emails discovered in a separate investigation into former Congressman Anthony Weiner.

He said he had two choices -- to speak or to conceal. Speaking, he said, would be "really bad," but concealing the new information would be "catastrophic."

"It makes me mildly nauseous to think we might have had some impact on the election," Comey said.

At the opening of the hearing, committee chairman Chuck Grassley of Iowa had tough words for the FBI director, listing a series of issues he has taken with the agency, such as leaks. "A cloud of doubt hangs over the FBI's objectivity," he said.

Senator Dianne Feinstein of California, ranking member of the committee, noted that the hearing takes place at "a unique time."

Comey said he is not behind leaks to the press on FBI investigations into Clinton's use of email as Secretary of State or Russia's meddling in the U.S. election and the Trump campaign's ties to Russia. He declined to confirm whether the FBI or Department of Justice is investigating leaks currently.

"I don't want to confirm in an open setting whether there are any investigations open," he said.

Comey's testimony comes a day after Clinton pointed to Comey's October 28 letter to Congress as a contributing factor to her loss, along with interference by Russian hackers, at the Women for Women International event in New York.

"If the election had been on October 27, I would be your president," she said.

"I would make the same decision," Comey said on Wednesday.

Jim Cramer has an investment club. Learn more and get a free trial subscription to Action Alerts Plus.