FBI Director James Comey Jr. testifies Thursday before the Senate Homeland Security and Governmental Affairs Committee on Capitol Hill. (MICHAEL REYNOLDS/EPA)

FBI Director James B. Comey testified Thursday that the risk of cyberattacks is likely to exceed the danger posed by al-Qaeda and other terrorist networks as the top national security threat to the United States and will become the dominant focus of law enforcement and intelligence services.

Appearing before the Senate Homeland Security Committee, Comey said he expected Internet-related attacks, espionage and theft to emerge as the most consuming security issue for the United States by the end of his 10-year FBI term.

“We have connected all of our lives — personal, professional and national — to the Internet,” Comey said. “That’s where the bad guys will go because that’s where our lives are, our money, our secrets.”

The warning underscored the growing sense of alarm among officials in Washington over the nation’s vulnerability to online attacks as well as the diminished ability of al-Qaeda to mount plots against the United States after more than a decade of CIA drone strikes and other counterterrorism operations.

Comey was among three of the nation’s top security officials to testify Thursday that the risk of a major terrorist attack in the United States is seen as lower now than at any time since before the strikes on Sept. 11, 2001.

The threat has diminished overall but “is more dispersed geographically” because of al-Qaeda’s ability to gain footholds in Syria, North Africa, Yemen and elsewhere, said Matthew G. Olsen, director of the National Counterterrorism Center. As a result, Olsen said, the terrorism risk “has become more significant from a geographic perspective and more complicated from an intelligence perspective.”

The officials cited a spate of seemingly unrelated attacks over the past 14 months that were linked to al-Qaeda or aligned groups but not orchestrated by its leadership core in Pakistan. Among them were the mass shooting at a shopping mall in Kenya, the seizure of a petroleum plant in Algeria and the assault on U.S. compounds in Benghazi, Libya.

In Syria, Olsen said, the intelligence picture for U.S. counterterrorism officials has been clouded further by a “blurring of the line” between terrorist, insurgent and criminal groups that have collaborated to varying degrees in that country’s civil war.

Rand Beers, the acting homeland security secretary, said his agency is working with European allies to identify and track militants from Western nations who may travel to Syria and then seek to return.

Despite that potential danger, officials said that the main terrorist threat inside the United States is that U.S. citizens or residents could adopt militant ideologies and develop plans for domestic attacks without communicating with terrorist networks or traveling overseas.

Tamerlan and Dzhokhar Tsarnaev, ethnic Chechen brothers accused of carrying out the bombings at the Boston Marathon this year, had “no formal or direct ties to al-Qaeda” but had embraced aspects of the terrorist group’s ideology, Olsen said. He added that cooperation with Russian intelligence services has improved since the Boston attacks.

The officials said counterterrorism efforts had been damaged by leaks of U.S. intelligence operations by former National Security Agency contractor Edward Snowden, and they warned of the impact of the budget cuts known as sequestration. Comey said the FBI is in the process of eliminating 3,500 positions because of budget pressures.

Despite concern about “homegrown extremists,” Comey said that he had concluded after just two months on the job that cyberthreats are likely to be more worrisome in the long term.

“That is why we anticipate that in the future, resources devoted to cyber-based threats will equal or even eclipse the resources devoted to non-cyber-based terrorist threats,” Comey said.

On a separate issue, Comey said he had no objection to congressional testimony by survivors of the Sept. 11, 2012, attack in Benghazi.

The Justice and State departments have resisted congressional requests for testimony by Diplomatic Security officials who were present at the attack, saying that their appearance could compromise possible future prosecution of the perpetrators.

Under subpoena, two DS agents provided sworn depositions last month to the House Oversight and Government Reform Committee. The majority of U.S. personnel present that night were from the CIA, assigned to an intelligence annex near the diplomatic site. Among a total complement of two to three dozen State Department, CIA and contractor personnel at the two locations, four were killed in the attacks, including the U.S. ambassador to Libya, J. Christopher Stevens.