WASHINGTON, Aug 23 (Reuters) - With thousands of desperate Afghans and foreigners crowding into Kabul airport in the hope of fleeing Afghanistan's new Taliban rulers, US officials said on Monday (Aug 23) they were scrambling to figure out how to extend a looming Aug 31 deadline to airlift Americans and their allies to safety.

Biden warned on Sunday that the evacuation was going to be "hard and painful" and a lot could still go wrong. US troops might stay beyond their Aug 31 deadline to oversee the evacuation, he said.

Two US officials said the expectation was that the United States would continue evacuations past Aug 31. A senior State Department official told reporters the country's commitment to at-risk Afghans "doesn't end on Aug 31".

A Taliban official said foreign forces had not sought an extension and it would not be granted if they had. US officials said negotiations were continuing.

White House national security adviser Jake Sullivan said the United States was in daily talks with the Taliban and making "enormous progress" in evacuating Americans and others.

Asked if Biden would extend his deadline, Sullivan said the president was "taking this day by day, and will make his determinations as we go".

Despite Sullivan's optimistic comments, US officials told Reuters that almost everything would have to go perfectly to extricate every American citizen by Aug 31. The officials said there was concern about US citizens reaching the airport, terrorist attacks and complicated processing times.

Additionally, US officials said that because it would take several days to remove the nearly 6,000 troops at the airport, Biden would have to make a decision soon on whether to observe the deadline, potentially in the next 24 hours.

US State Department spokesman Ned Price told reporters on Monday that the United States had discussed future control of the airport with the Taliban, as well as with US partners and allies.