Top US General, Mark Milley, has warned al-Qaeda terrorists in Afghanistan could threaten the US in as little as 12 months.
The Taliban had not broken ties with the group responsible for 9/11 and themselves remained a terror organisation, Gen Milley said.
He and Defence Secretary Lloyd Austin were questioned in Congress about last month’s pullout from Afghanistan.
The government collapsed as the Taliban rapidly advanced through the country.
Senator and committee leader, Jack Reed, said lawmakers wanted to understand whether the US “missed indicators” of the government’s collapse.
Tuesday’s hearing began with opening testimony from Defence Secretary Lloyd Austin followed by Gen Milley.
Gen Milley said the US would have to continue to protect its people from terrorist attacks from Afghanistan, and that mission would now be harder.
“The Taliban was and remains a terrorist organisation and still has not broken ties with al-Qaeda,” he said.
“A reconstituted al-Qaeda or ISIS [Islamic State group] with aspirations to attack the US is a very real possibility, and those conditions to include activity in ungoverned spaces could present themselves in the next 12-36 months.”
Gen Milley said he made an assessment in late 2020 that an accelerated troop withdrawal from Afghanistan could precipitate the government’s collapse.
But both he and Mr Austin both testified that the speed of the collapse caught the US military off-guard.
“The fact that the Afghan army we and our partners trained simply melted away – in many cases without firing a shot – took us all by surprise,” Mr Austin said.
Another US general, Kenneth McKenzie, also appeared at the hearing. As head of US Central Command, he oversaw the withdrawal from Afghanistan.
A suicide attack killed 182 people during the withdrawal operation. Thirteen US service personnel and at least 169 Afghans were killed by the airport gate on 26 August.
US troops first entered Afghanistan in late 2001, shortly after the 9/11 attacks. By the time they left, the US had spent about $985bn (£724bn) and deployed tens of thousands of troops, peaking at 110,000 in 2011.
The US has said it will now move towards counter-terrorism missions.