FBI director James Comey conceded that he is a “deeply flawed” person who failed to stop some terrorist attacks before they happened. Comey made the admission while being interrogated Tuesday before the Senate Committee on Homeland Security and Governmental Affairs.

Comey faced pointed questions about recent terrorist shootings and bombings in the United States and about his failure to recommend indictment for Hillary Clinton in her private server scandal. Comey is under fire in the public for these failures, with Breitbart News recently reporting on his financial links to the Clinton Foundation.

“Is it your position that no mistakes were made in each of these in judging them not to be credible threats?,” Kentucky Senator Rand Paul asked Comey, referring to multiple instances of the FBI failing to act on evidence that it had on various terrorist suspects before they killed Americans. “Would you not have done more in the gun store that Mateen came into six weeks before the shooting? Would you not have done more when Rahami was arrested in questioning him because his dad said he was a terrorist?”

In a rare moment of candor, Comey made a stunning admission.

“Thank you, Senator. Sitting before you is a deeply flawed and fallible human being who believes very strongly in admitting mistakes when they’re made,” Comey said. “I hope you saw the very painful moment when I admitted publicly we made a mistake in allowing Dylan Roof to get a gun. So, as long as I’m director of the FBI we will stare back very carefully at what we do, and where we make mistakes we will admit them, and we will be transparent and we will get better.”

“We are not perfect people,” Comey conceded, noting that a pending inspector general investigation will help the FBI learn from its mistakes.

“Yes, he was interviewed twice during a seven-month investigation,” Comey told New Hampshire Sen. Kelly Ayotte, referring to Omar Mateen. Asked if the FBI tracked Mateen’s online activity, Comey said, “I don’t know the answer. I don’t think so at this point.”

Comey also detailed how he was out-maneuvered by top Clinton aide Cheryl Mills’ lawyers during the Clinton email investigation.

“The immunity was, we will not use, the Department of Justice, anything against you on this laptop,” Comey said, on the subject of Mills being granted immunity. “This was, in the negotiation, a tool to get the laptop.”

“Well it’s a lawyer’s laptop,” Comey said. “By June of this year I wanted that laptop… This was the way to get it.”

Department of Homeland Security Chief Jeh Johnson also testified at the hearing, which focused on national security concerns.

Johnson confirmed that there have been “efforts to get into voter registration rolls” in the United States, but the agency “has not determined” yet whether a specific foreign country is to blame.

Johnson admitted that U.S. programs to stop Middle Eastern migrants from crossing the Southern border is “limited.”

“I think that’s a very legitimate concern and we are focused on it,” Johnson said on the topic of “migrants from the other hemisphere.”