Updated

FBI Director James Comey told lawmakers Tuesday his agency will learn from any missteps it might have made leading up to last week’s Manhattan bombing, amid reports that the alleged bomber had been known to agents for at least two years.

Comey, who was testifying before the Senate Homeland Security Committee hearing, also said that when the FBI makes a mistake, the agency is open about it.

In two recent cases, he noted the FBI is looking over its past investigation of the Orlando nightclub shooter -- and the bureau's prior interactions with the father of Ahmad Rahami, who was charged last week in the Manhattan explosion that left dozens injured.

“We’re going to go back and look very carefully about the way we encountered him,” Comey said.

Rahami's father has said he alerted the FBI about his son two years ago, though one source also told Fox News he later recanted. Still, his father complained about the FBI's response.

Kentucky Republican Sen. Rand Paul pressed Comey at Tuesday's hearing on allegations several individuals accused of attacks had at one point been known to the FBI. He asked Comey whether mistakes had been made in those investigations.

The FBI director pushed back and told Paul he had his facts wrong.

Sen. Kelly Ayotte, R-N.H., also challenged Comey on the country’s readiness in dealing with the threat of another terror attack on U.S. soil.

“What more do we need to do? What are the lessons learned, and if you need additional support, we need to know about it very quickly,” she said.

Comey testified alongside Homeland Security Secretary Jeh Johnson and Nicholas Rasmussen, director of the National Counterterrorism Center, at the hearing examining threats to national security 15 years after the 9/11 attacks.

Comey also warned that law enforcement and intelligence agencies remain extremely concerned that violent extremists will eventually flow out of Syria and Iraq and into other countries in hopes of committing attacks.

The number of Americans traveling to Syria to fight alongside the Islamic State group has slowed to a trickle in the last year, but as the so-called caliphate becomes "crushed," many militants from Western nations who are already there will stream out of the region and create new security threats, he warned.

"There will be a terrorist diaspora sometime in the next two to five years like we've never seen before," Comey said.

The hearing took place just over a week after bombings in New York and New Jersey and a separate stabbing attack at a Minnesota mall.

Rasmussen said that in addition to the Islamic State militants, U.S. government officials are concerned about the capabilities and ambitions of Al Qaeda and its affiliates.

Johnson said terrorist threats have evolved, moving from terrorist-directed attacks "to a world that also includes the threat of terrorist-inspired attacks" in which individuals who live in the U.S. are "self-radicalized" to attack their own country.

Johnson says that by their nature, terrorist-inspired attacks are difficult to detect by intelligence and law enforcement communities, can occur with little or no notice and in general make for a more complex homeland security challenge.

The panel's chairman, Sen. Ron Johnson, R-Wis., said the threat of "militant Islamic terrorist attacks to the United States remains significant," citing the Sept. 17 attacks in the New York region and Minnesota, as well as deadly attacks in San Bernardino, Calif., and Orlando.

"In all, Islamic extremist terrorist have killed 63 people on U.S. soil since our committee last held its annual hearing to consider threats to the homeland," the chairman said in a prepared statement.

Two years after President Obama stated a goal of defeating the Islamic State group, also known as ISIS, "we have made little progress," said the senator, who is not related to the Homeland Security chief.

Ahmad Khan Rahami, the main suspect in the New York bombing, faces federal terrorism charges after a shootout with police last week.

Prosecutors say Rahami, 28, planned the explosions for months as he bought components for his bombs online and set off a backyard blast. They say he wrote a journal that praised Osama bin Laden and other Muslim extremists, fumed about what he saw as the U.S. government's killing of Muslim holy warriors and declared "death to your oppression."

While Republican presidential nominee Donald Trump has suggested a temporary ban on Muslim immigrants, Jeh Johnson said the U.S. should focus on "building bridges to diverse communities" to defend the homeland.

The Associated Press contributed to this report.