Testifying before the Senate judiciary committee as part of its oversight into the Crossfire Hurricane investigation, Comey disputed assertions by Trump, Republican senators and Attorney General William Barr that the probe was unfounded and politically motivated.
"Crossfire Hurricane" was the code name given to the FBI investigation into links between Trump's campaign and Russian officials, as well as whether there was coordination between the two parties to interfere in the election four years ago.
"This was an investigation that was appropriately predicated and that had to be opened and it was in the main conducted in the right way," Comey said, adding that the probe eventually resulted in nearly 200 criminal charges and dozens of indictments or guilty pleas after being taken over by Special Counsel Robert Mueller.
"The notion that the attorney general believes that was an illegitimate endeavor to investigate mystifies me," Comey said.
Republicans have long criticized the inquiry. The Trump administration declared invalid two of four surveillance warrants related to former campaign adviser Carter Page after Justice Department Inspector General Michael Horowitz outlined 17 inaccuracies in three applications filed under the Foreign Intelligence Surveillance Act.
In 2018, Trump directed the department to declassify text messages sent by Comey and former FBI officials Andrew McCabe, Peter Strzok, Lisa Page and Justice Department official Bruce Ohr.
Comey, who appeared via video, conceded the bureau made some mistakes in the case, but asserted, "Overall, I'm proud of the work."
Committee chair Sen. Lindsey Graham, R-S.C., repeatedly pressed Comey on why Page was targeted for surveillance despite the emergence of exculpatory information.
"How could all that happen and not get up to you, the director of the FBI, of one of the most important investigations in the history of the FBI?" he asked.
"I can only speculate, because it didn't," Comey replied.
Graham said the committee is negotiating with McCabe to secure testimony, but Mueller declined an invitation to testify, saying he would not have enough time to prepare.
Sen. Patrick Leahy, D-Vt., criticized Graham's handling of the hearing.
"This seems more like a political errand for President Trump's reelection effort," he said. "I think it's offensive to all Americans who pay taxes. I realize the president does not."