James Comey, based on public comments from top Trump surrogate Rudy Giuliani and others in October 2016, launched an investigation into leaks about the Hillary Clinton email investigation that he suspected originated in the New York field office, he told congressional investigators Friday, but said he was fired from the FBI before it reached a conclusion.

Comey said Giuliani appeared to be making statements at the time “based on his knowledge of workings inside the FBI,” raising concerns to him “that we may have a leak problem,” according to a transcript of the former FBI director’s testimony released Saturday.

Facing questions from both Democrats and Republicans on the House Judiciary and Oversight committees, Comey also told lawmakers that he was willing to “bet my life” that Robert Mueller was conducting his sweeping probe of the president, former campaign associates and Russia’s interference in the 2016 election with integrity.

Former FBI Director James Comey testified Friday to the House Judiciary and Oversight and Government Reform committees in Washington. Chip Somodevilla / Getty Images

“There are not many things I would bet my life on. I would bet my life that Bob Mueller will do things the right way, the way we would all want, whether we're Republicans or Democrats, the way Americans should want,” he said.

Comey spent nearly seven hours Friday before the joint committee hearing, as part of a GOP-led investigation into how the Justice Department handled both the Clinton email investigation and the origins of a counterintelligence investigation of Russia’s interference in the last presidential election.

Democrats have blasted the effort as nothing more than an attempt to undermine public confidence in the special counsel investigation overseen by Robert Mueller. Rep. Jerry Nadler, D-N.Y., who will likely become chairman of the Judiciary Committee when Democrats take control of the House next month, told reporters Friday he would end the joint committee investigation.

Comey also expressed frustration to reporters after his testimony that most of the questions he faced were focused on the Clinton email investigation, something he has addressed before multiple other congressional panels and in his own book. Lawmakers have asked him to return on Dec. 17 for additional questions.

“I'm not sure that we need to do this at all," he said. "But, I'm trying to respect the institution and answer questions in a respectful way.”

Comey did tell lawmakers that he would have removed senior DOJ officials Peter Strzok and Lisa Page from their roles as part of the Clinton email probe if he had known at the time about a cache of text messages between the two that showed a bias against Trump.

“Based on what I have seen in the media since I left the FBI, that unless there was some explanation for that that I was missing, in my judgment, they wouldn't have remained part of the investigation,” he said.

But he later said that nothing in how Strzok handled his work led him to believe he was acting on any personal political beliefs.

"Peter Strzok helped draft my letter to Congress on October 28th that Hillary Clinton blames for her defeat. So it's hard for me to see how he was on Team Clinton secretly at that point in time,” he said.

The transcript was released as a condition for Comey agreeing to testify behind closed doors. He initially sought to quash the Judiciary Committee’s subpoena, having offered already to answer questions in a public hearing.

The joint committee investigation initially was to focus on the Justice Department’s handling of the Clinton email probe but expanded to incorporate questions about when federal investigators first began scrutinizing potential ties between Russians and Trump campaign associates.

Republicans expressed frustration that Comey was prevented from answering key questions related to the ongoing Mueller probe on the advice of a Justice Department lawyer who was present for the interview.

Republicans have seized on the fact that information from a dossier exploring then-candidate Trump’s connections to the Kremlin, compiled by a former British intelligence operative at the behest of an opposition research firm paid in part by Democrats, was cited in the application for a secret surveillance warrant on a Trump campaign foreign policy aide, Carter Page.

Comey did tell lawmakers that he personally was not aware during his time as FBI director that Christopher Steele’s research for Fusion GPS was paid for at least in part by a law firm with ties to the Clinton campaign.

Some of Comey’s testimony covered his view of events that have taken place since he was dismissed as FBI director in early 2017.

Asked by one Democratic lawmaker what would happened to the special counsel’s investigation if the president were to fire Mueller, Comey responded that it was unlikely to derail it.

“As an informed outsider … you'd almost have to fire everyone in the FBI and the Justice Department to derail the relevant investigations,” he said.

Comey did praise Trump’s new nominee to serve as attorney general, William Barr, saying he was “certainly fit” to return to the post he held in the George H. W. Bush administration. He said he was confident that Barr would seek advice of career officials at the Justice Department about whether his comments about Clinton, Trump and the Mueller probe made as a private citizen should force him to recuse himself from overseeing the Mueller team.

“It raises a question with respect to him, so I'm sure he's going to want to look at it, as will the Senate, very closely,” Comey said.