Two top US generals have said they recommended keeping a force of 2,500 troops in Afghanistan, ahead of the full US withdrawal in August.
Testimony by Gen Mark Milley and Gen Frank McKenzie to Congress seemed to contradict President Joe Biden, who said he did not recall any such advice.
The Taliban took power in August, after rapidly advancing through the country.
Gen Milley said the US had been taken by surprise by the speed of the Afghan government's collapse.
The two US generals were questioned by the Senate armed services committee along with Defence Secretary Lloyd Austin on Tuesday.
The hearing comes weeks after a chaotic withdrawal at Kabul airport as foreign powers sought to get their citizens home and thousands of desperate Afghans begged for rescue.
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.
Keeping troops on the ground
Gen McKenzie, who as head of US Central Command oversaw the withdrawal from Afghanistan, said under questioning from Republican senators that he recommended keeping a small force of 2,500 troops in Afghanistan.
This appears to contradict President Joe Biden's assertion to an ABC journalist on 19 August that he did not recall anyone giving him such advice.
Gen Milley said that he agreed with the recommendation, but when asked by Alaska Republican Dan Sullivan whether Mr Biden's comments were "a false statement", he refused to give a direct answer.
Later White House spokeswoman Jen Psaki addressed the issue.
"The president values the candid advice of... the joint chiefs and the military," she said. "That doesn't mean he always agrees with it."
She said that if troops remained in the country after the August deadline the US would now be at war with the Taliban.
Generals undercut Biden's words
Analysis box by Anthony Zurcher, North America reporter
Mark Milley, Lloyd Austin and Kenneth McKenzie may have been testifying before Congress, but Joe Biden's own words did the most damage to the president on Tuesday.
Republicans hammered the president for recent statements that the generals, either explicitly or indirectly, contradicted.
During an August interview, Biden insisted there were no generals urging him to keep some US troops in Afghanistan to prevent a Taliban takeover. Both Gen Milley and Gen McKenzie said they thought those troops were needed and, at one point, the latter said he told the president as much.
Republican senators also questioned why Mr Biden had promised to keep the military in place until all US citizens were evacuated, given that there are still Americans in Afghanistan weeks after the final withdrawal.
Finally, both generals firmly stated that al-Qaeda is still present in Afghanistan - directly contradicting Biden's earlier statement that the terrorist organisation had been eradicated.
All that gave Republicans ammunition to accuse the president of lying to the American people.
Mr Biden didn't have to make such sweeping assurances. He could have simply said he considered the military's advice but stood by his decision to withdraw. Like many politicians before him, however, he talked his way into trouble.
'Caught off-guard'
Tuesday's hearing began with opening testimony from Mr Austin, followed by Gen Milley, who said it would now be harder to protect Americans from terrorist attacks from Afghanistan.
"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.
"We helped build a state, but we could not forge a nation," Mr Austin 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."
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.
In the weeks between the fall of Kabul and the withdrawal deadline of 31 August, the US evacuated its remaining 4,000 troops. It is also taking about 50,000 Afghan refugees who were airlifted out of Kabul.
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
'We are not going to attack China'
It emerged recently that Gen Milley held phone conversations with the Chinese military following concerns about then-President Donald Trump.
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 directed 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.'"