
EPA image caption,Thousands of Afghans sought to leave through Kabul airport, which was guarded by US troops
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 are being 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.
The US has said it will now move towards counter-terrorism missions.
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.
‘Caught off-guard’
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.”
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, is also appearing. As head of US Central Command, he oversaw the withdrawal from Afghanistan.
The three men are now answering questions from members of Congress.
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.
As many as 20 people died in the crowds which gathered at the airport in the days after the Taliban takeover.

Who is Gen Mark Milley?
- He’s Joe Biden’s top military adviser – the chairman of the Joint Chiefs of Staff (the committee of the eight highest-ranking military officials)
- He’s not part of the chain of command with the military and does not order US forces
- However, he is the link between the White House and the Pentagon
- He was a four-star officer and the Army Chief of Staff before being appointed to lead the Joint Chiefs of Staff in October 2019

Gen Milley is facing tough questioning, especially from Republicans, who have called for him to be sacked.
He and Gen McKenzie will probably be asked about a US drone strike in Kabul on 29 August which killed 10 innocent members of a single-family.

After the attack, Gen McKenzie said US intelligence had tracked a car belonging to one member of the family, an aid worker, believing it was linked to a branch of the Islamic State (IS) group.
Gen Milley originally described the attack as a “righteous strike”. After the Pentagon established that the dead were all civilians, he backtracked, admitting that he had spoken too soon.
‘We are not going to attack you
The phone calls were revealed in a book by journalist Bob Woodward, who also said Gen Milley had told his staff that if Mr. Trump ordered a nuclear strike, then he would have to confirm it before it was carried out.
Top Republican Senator Marco Rubio has described this as “treasonous”.
But Gen Milley told the hearing the calls were coordinated with then-Defence Secretary Mark Esper and his acting successor Christopher Miller.
“I know, I am certain that President Trump did not intend to attack the Chinese… and it was my directive responsibility by the secretary to convey that intent to the Chinese.
“My task at that time was to de-escalate. My message again was consistent: ‘Stay calm, steady, and de-escalate. We are not going to attack you.'”