The nation’s top intelligence and law enforcement officials testified Wednesday before the Senate on a range of threats facing the United States, including a rising China and the origins of the virus that caused the covid-19 pandemic.

The annual hearing brings together the top leadership of the intelligence community for what often amounts to a tour of the world’s tribulations. This year, officials faced questions from members of the Senate Intelligence Committee about President Biden’s decision to withdraw all American troops from Afghanistan by Sept. 11, the 20th anniversary of the terrorist attacks that drew the United States into the longest war in the nation’s history.

Sen. Susan Collins (R-Maine) asked whether the departure of U.S. troops put the country at a greater risk of terrorist attacks should al-Qaeda or Islamic State fighters gain a new foothold in Afghanistan.

CIA Director William J. Burns said that the presence of U.S. and coalition forces has enhanced the intelligence community’s ability to monitor terrorist threats in the country, including those that could affect the United States directly, and that that ability will diminish when forces leave.

But, he said, the agency will “retain a suite of capabilities,” some of which are already in place, and some which will have to be developed, to help provide warnings to U.S. officials.

Burns also said it is an open question whether terrorists would choose to regroup in the country or be able to do so easily. Al-Qaeda and the Islamic State would face opposition from the Afghan government as well as the Taliban, which he described as an “ideological rival” of the Islamic State. He said the Taliban also has a powerful incentive to keep al-Qaeda from reestablishing itself. Some analysts think the Taliban will want to establish their legitimacy with the international community and garner financial support if they come to power and therefore will not tolerate an influx of foreign terrorists.

The hearing, which included an overview of global threats by Director of National Intelligence Avril Haines, marks the resumption of annual testimony that was put on hold during the Trump administration. The decision frustrated Republican and Democratic lawmakers who have called the hearings the American public’s best opportunity to hear an overview of global security challenges from the officials in charge of addressing them.

The same officials will appear before the House Intelligence Committee on Thursday.

Before the hearings, the intelligence community published its annual threat assessment, which said China was pursuing a “whole-of-government” effort to spread its influence around the world, undercut U.S. alliances and “foster new international norms that favor the authoritarian Chinese system.”

Haines called China “an unparalleled priority for the Intelligence Community,” and said Beijing possesses “substantial cyber capabilities that if deployed, at a minimum, can cause localized, temporary disruptions to critical infrastructure inside the United States.”

Sen. Marco Rubio (R-Fla.), the committee’s vice chairman, said he was especially concerned that the United States had not developed an effective strategy of deterrence that makes clear to hostile countries what kinds of malicious cyber actions cross a line and are more analogous to armed conflict than espionage.

He pointed to the recent SolarWinds hack, a major breach of U.S. companies and government agencies that experts have attributed to Russia, which he said “demonstrates how easily U.S. infrastructure can be compromised.”

Although China is the United States’ most formidable adversary, it’s not invulnerable to the forces challenging big and small countries, Haines said. China’s “economic, environmental and demographic vulnerabilities all threaten to complicate its ability to manage the transition to the dominant role it aspires to in the decades ahead.”

In his opening remarks, Sen. Mark R. Warner (D-Va.), the committee chairman, emphasized that his concerns were with the government of China.

“Our problem is with the Chinese Communist Party, not with the people of China or the Chinese diaspora globally, and certainly not with Asian Americans here in the United States,” Warner said. “I want to caution our fellow Americans that false equivalencies only breed suspicion, division and hate . . . and play right into Beijing’s hands.”

Officials also were asked about China’s responsibility in the coronavirus outbreak, and whether the spy agencies had determined the origins of the virus.

“The intelligence community does not know exactly where, when or how covid-19 was transmitted initially,” Haines said. Theories have coalesced, she added, around two scenarios — natural transmission from animals to humans and a possible accident at a lab.

The “lab leak” theory has been controversial among scientists. There is no evidence that the coronavirus escaped from any lab, including the Wuhan Institute of Virology, a renowned research center in the city where the first clusters of covid-19 cases emerged.

Haines said the intelligence community is investigating all theories. Burns noted that the Chinese government “has not been fully forthcoming or fully transparent . . . in providing the kind of original complete data that would help answer those questions.”

Recently, the director of the World Health Organization also said that China had not been forthcoming and that the lab-leak theory needed further investigation.

The intelligence report identifies Iran, North Korea and Russia as other key U.S. adversaries, and it looks at crosscutting issues including climate change and the coronavirus pandemic that are likely to have significant effects on U.S. security.