WASHINGTON — James B. Comey, the F.B.I. director, on Wednesday sharply defended his rationale for notifying Congress about new emails related to the Hillary Clinton investigation less than two weeks before Election Day, saying any suggestion that he had affected the vote’s outcome made him “mildly nauseous.”

Mr. Comey’s comments were his first public explanation about his actions, which roiled the presidential campaign in its final days.

The F.B.I. director said he went public on Oct. 28 because he believed his agents had possibly found emails that could provide insight into Mrs. Clinton’s reasons for using a private email server and change the outcome of the investigation. Mr. Comey said that failing to inform Congress would have a required an “act of concealment.”

The Run-Up

The podcast that makes sense of the most delirious stretch of the 2016 campaign.

“Concealment in my view would have been catastrophic,” Mr. Comey said.

Unlike a House Intelligence Committee hearing in March in which Mr. Comey took the extraordinary step of confirming the existence of an investigation into Russian meddling in the election, the Senate Judiciary Committee hearing Wednesday was a more routine congressional oversight procedure. But it nonetheless produced the dramatic moment from Mr. Comey.

The tone of the opening statements from both the top Republican and the top Democrat on the committee made clear that they wanted answers from Mr. Comey on a number of issues, including Mrs. Clinton’s emails, the Russia investigation, leaks to the news media and the use of wiretapping as an investigative tool.

“We need the F.B.I. to be accountable because we need the F.B.I. to effective,” said Senator Charles E. Grassley, Republican of Iowa and the chairman of the committee.

Senator Dianne Feinstein, the ranking Democrat on the panel, immediately pounced on Mr. Comey, demanding to know why he treated the investigations so “dramatically different.”

Interactive Feature | Comey Tried to Shield the F.B.I. From Politics. Then He Shaped an Election.

Mr. Comey’s handling of the Clinton email investigation continues to shadow him. Not even President Trump seems keen to forget the decisions The F.B.I. director made during the election. On Tuesday night, the president criticized him in a Twitter post, writing that Mr. Comey was “the best thing that ever happened to Hillary Clinton in that he gave her a free pass for many bad deeds!”

Mr. Trump also played down the F.B.I.’s investigation into Russian efforts to help his campaign.

“The phony Trump/Russia story was an excuse used by the Democrats as justification for losing the election,” the president wrote on Twitter, apparently in reaction to Ms. Clinton’s comments on Tuesday in which she heaped blame on the F.B.I. and Russian-backed hackers for her election loss. She also said Mr. Trump was unprepared for the presidency.

The warm reception Mr. Comey once received on Capitol Hill, where he was applauded for his efforts to keep the country safe, has cooled considerably in recent months.

Mr. Comey plunged himself into last year’s campaign when he announced at a news conference in July that the F.B.I. was closing the Clinton email investigation. Though he said he would not recommend charging Mrs. Clinton or her aides, he also criticized her for how she had handled government information.

The criticism angered Democrats. Months later, they fumed anew over Mr. Comey’s decision to send a letter to Congress — less than two weeks before Election Day — saying the F.B.I. had found more emails pertinent to the investigation. The emails turned out not to change the outcome of the investigation, but that revelation upended the election and later prompted accusations from some Clinton supporters that Mr. Comey had cost her the White House.

In March, Democrats got some satisfaction when Mr. Comey acknowledged before the House Intelligence Committee that the F.B.I. had opened an investigation over the summer into Russian meddling in the presidential election and whether any Trump associates were involved. But they also criticized Mr. Comey for not confirming the existence of that inquiry sooner.

Republicans have grilled Mr. Comey over his decision not to recommend charges in the Clinton email investigation, and over a string of leaks to the news media from unnamed officials that were seen as damaging to Mr. Trump in the early days of his administration and in the weeks before the inauguration.

On Wednesday, Mr. Grassley asked Mr. Comey about a document the F.B.I. obtained that influenced his thinking in the Clinton investigation. Mr. Comey said he could only respond in a classified setting and had briefed congressional leaders about the document.

Interactive Feature | Get the Morning Briefing by Email What you need to know to start your day, delivered to your inbox Monday through Friday.

The document, described alternately by officials as a memo or an email, was written by a Democratic operative and suggested that Attorney General Loretta E. Lynch would keep the Clinton investigation from going too far. Little else is publicly known about it, but it raised questions in the eyes of Mr. Comey and his aides about Ms. Lynch’s independence.

Last month, Mr. Grassley wrote to Mr. Comey and the Justice Department asking for information about the document, which, in a twist, had been stolen by Russian hackers.

Former United States officials familiar with the document said Mr. Comey feared that if Russia leaked the material, it would undermine the F.B.I. investigation. But former Justice Department officials said there was no evidence linking Ms. Lynch to the Democratic operative.

“A clear explanation is needed even more in light of the reporting that Director Comey had misgivings about Attorney General Lynch’s ability to appear impartial if the Russians released the email memo suggesting that she would ensure the F.B.I.’s inquiry would not go ‘too far,’” Mr. Grassley wrote.

Late Tuesday, on the eve of Mr. Comey’s testimony, Mr. Trump accused the F.B.I. director of last year giving Mrs. Clinton, the Democratic presidential nominee, “a free pass for many bad deeds!”

Mr. Comey has tried to keep a low profile since the March hearing, where he talked about the Russia investigation and dismissed Mr. Trump’s claim that he had been wiretapped by President Barack Obama.

Later that month, Mr. Comey spoke to national security experts at a dinner that members of the news media attended. His agenda was clear.

“I’m determined not to make news,” he said.