Top US generals on September 28 said they advised President Joe Biden to keep US troops in Afghanistan and expressed concern that the Taliban has not severed ties with al-Qaeda.

Joint Chiefs of Staff chairman General Mark Milley and US Central Command commander General Kenneth McKenzie said they had personally recommended that some 2,500 troops remain on the ground in Afghanistan.

Biden, in April, ordered a complete pullout of US forces from the country by August 31, following through on an agreement reached with the Taliban by former president Donald Trump.

Milley, McKenzie and defence secretary Lloyd Austin were grilled for nearly six hours by members of the Senate Armed Services Committee about the US withdrawal from Afghanistan and the chaotic evacuation from Kabul airport.

White House press secretary Jen Psaki said Biden had received “split” advice about what to do in Afghanistan, which the US invaded following the September 11, 2001 al-Qaeda attacks on New York and Washington, dubbed “9/11”.

“Ultimately, it’s up to the commander-in-chief to make a decision,” Psaki said. “He made a decision that it was time to end a 20-year war.”

Milley, who shrugged off calls from some Republican lawmakers for him to resign, was asked whether the pullout and disorderly evacuation, during which 13 US troops were killed in a bomb attack, had damaged US credibility.

“I think that our credibility with allies and partners around the world and with adversaries is being intensely reviewed by them to see which way this is going to go and I think ‘damage’ is one word that could be used, yes,” he said.

Milley said the Taliban “was and remains a terrorist organisation and they still have not broken ties with al-Qaeda”, which plotted the 9/11 attacks from Afghanistan.

“It remains to be seen whether or not the Taliban can consolidate power or if the country will fracture into further civil war,” he said. “But we must continue to protect the American people from terrorist attacks emanating from Afghanistan.”

A reconstituted al-Qaeda or Islamic State with aspirations to attack the US remains “a very real possibility”, he said, but “it’s too early to determine their capability”.

Austin said the US “did not fully comprehend the depth of corruption and poor leadership” in the Afghan armed forces.

“We helped build a state, but we could not forge a nation,” he said.

“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,” the Pentagon chief said. “It would be dishonest to claim otherwise.”

Austin said the US had provided the Afghan military “with equipment and aircraft and the skills to use them” but “in the end, we couldn’t provide them with the will to win”.