General Mark Milley, chairman of the Joint Chiefs of Staff, said he believed the US should have kept several thousand troops in the country to prevent the Taliban takeover that happened faster than forecast.
He refused to say what advice he gave President Joe Biden last spring when Mr Biden was considering whether to keep any troops in Afghanistan.
But he told the Senate Armed Services Committee it was his personal opinion that at least 2500 were needed to guard against a collapse of the Kabul government and a return to Taliban rule.
In a blunt assessment of the outcome to a war that cost 2461 American lives, General Milley called it a strategic failure.
"The enemy is in charge in Kabul," he noted, referring to the Taliban having taken control of the capital on August 15.