The United States has completed the withdrawal of its forces from Afghanistan, the Pentagon has said, nearly 20 years after it invaded the country following the 11 September 2001 attacks on America.

Speaking this evening, US President Joe Biden said he will address the nation tomorrow on the "decision not to extend our presence in Afghanistan".

The US Central Command Chief General Frank McKenzie said that US and coalition military aircraft evacuated more than 123,000 civilians from Afghanistan.

He said that the US evacuated 6,000 American citizens from Kabul, which was the vast majority of those who wanted to leave. The number of US citizens who were not evacuated is in the "low hundreds" according to General McKenzie.

He also said the US Ambassador Ross Wilson and Commander General Chris Donahue were aboard the last C-17 flight out of the country, and that the Taliban had been "helpful and useful" to the US as the military closed down its Afghan operations.

General McKenzie said that the US operation did not manage to evacuate all those it wanted to help flee Afghanistan.

"There's a lot of heartbreak associated with this departure.We did not get everybody out that we wanted to get out," he said.

He added that it is estimated there are around 2,000 ISIS fighters in the country currently, and that the Taliban would have its "hands full" with the militants.

Upon the news that the last US troops had left, a senior Taliban official said: "We have made history."

The sound of gunfire was heard across Kabul after the US military confirmed the last US troops had left Afghanistan.

AFP correspondents in the city heard celebratory gunfire from several known Taliban checkpoints, as well as the cheers of fighters manning security posts in the green zone.

"Tonight at 12.00am Afghan time, the remaining American troops left Kabul airport and our country gained full independence," Zabihullah Mujahid, the Taliban's chief spokesman, said in a tweet.

"All praise to Allah."

"We made history again," tweeted Anas Haqqani, a senior official in the hardline Islamist movement.

"I am very happy that after 20 years of jihad, sacrifices & hardships I have this pride to see these historic moments."

Another Taliban spokesman, Bilal Karimi, told AFP by phone: "All the American troops have left Afghanistan, we are very happy -- you can listen to the celebratory fire."

Biden statement

In a statement announcing his planned address tomorrow, Mr Biden praised the military for carrying out the evacuation of final US troops, diplomats, and nearly all Americans, as well as tens of thousands of Afghan allies who worked for or fought alongside international forces in the war.

"The past 17 days have seen our troops execute the largest airlift in US history, evacuating over 120,000 US citizens, citizens of our allies, and Afghan allies of the United States," Mr Biden said.

"They have done it with unmatched courage, professionalism, and resolve. Now, our 20 year military presence in Afghanistan has ended."

Mr Biden repeated assurances by US and international officials that the Taliban have agreed to allow those groups to keep leaving now that they are in complete control of Kabul, including its airport.

"The international community expects the Taliban to deliver on moving forward, notably freedom of travel. The Taliban has made commitments on safe passage and the world will hold them to their commitments," he said.

The US president said that the goal was for the airport to reopen, "allowing for continued departure for those who want to leave and delivery of humanitarian assistance to the people of Afghanistan."

'Real' and 'specific' threats

Earlier, the Pentagon warned of "real" and "specific" threats of new attacks at Kabul airport, just hours ahead of the US deadline to complete its frenzied withdrawal from Afghanistan.

US President Joe Biden had set a deadline of tomorrow to withdraw all US forces from Afghanistan, drawing to a close his nation's longest war.

The Taliban movement's return to power a fortnight ago triggered a massive exodus of terrified people fearing a new version of their hardline Islamist rule.

US forces had been focused chiefly on flying themselves and American diplomats out safely.

The UN Security Council adopted a resolution requiring the Taliban to honour their commitment to let people freely leave Afghanistan in the days ahead, and to grant access to the UN and other aid agencies, but did not create a "safe zone" in Kabul.

The regional Islamic State-Khorasan (IS-K) group, rivals of the Taliban, pose the biggest threat to the withdrawal, after carrying out a suicide bombing outside the airport last week that claimed more than 100 lives, including those of 13 US troops.

Today, they claimed to have fired six rockets at the airport. A Taliban official said the attack was intercepted by the airport's missile defence systems.

Read more:

US drone strike wiped out Kabul family, says relative

First WHO flight since Taliban takeover lands in Afghanistan

Even as the US troop presence in Afghanistan drew to an end, Pentagon spokesman John Kirby told reporters that it was "a particularly dangerous time right now".

"The threat stream is still real, it's still active, and in many cases it's still specific," he said.

'We can't sleep'

The White House confirmed there had been a rocket attack directed at the airport, but said airlift operations there were "uninterrupted".

An AFP photographer saw a destroyed car with a launcher system still visible in the back seat.

"The president has reconfirmed his order that commanders redouble their efforts to prioritise doing whatever is necessary to protect our forces on the ground," a White House statement said.

While there were no reports of fatalities or airport damage from the apparent IS-K rocket salvo, they caused greater anxiety for locals already traumatised by years of war.

"Since the Americans have taken control of the airport, we can't sleep properly,"a resident told AFP news agency.

Afghan evacuees exit as US Air Force plane in Kosovo

"It is either gunfire, rockets, sirens or sounds of huge planes that disturb us. And now that they are being directly targeted, it can put our lives in danger."

A journalist in Kabul said there was a constant sound of planes overhead, with aircraft taking off and landing, as well as jets offering surveillance and protection.

'Potential loss of innocent life'

The United States said yesterday that it had carried out a drone strike against a vehicle threatening the Kabul airport that had been linked to the regional Islamic State chapter - its second targeting IS-K in recent days.

But today, it looked like they had possibly made a terrible mistake.

Members of one family said they believed a fatal error had been made, and that 10 civilians were killed.

"My brother and his four children were killed. I lost my small daughter, nephews and nieces," Aimal Ahmadi said.

Foreigners can leave Afghanistan, Taliban assures West
Is Afghanistan testing relations between the US and its allies?

"We are aware of reports of civilian casualties following our strike on a vehicle in Kabul today," Captain Bill Urban, a US Central Command spokesman, said in a statement.

"We would be deeply saddened by any potential loss of innocent life."

In recent years, the Islamic State's Afghanistan-Pakistan chapter has been responsible for some of the deadliest attacks in those countries.

They have massacred civilians at mosques, public squares, schools, and even hospitals.

While both the Islamic State and the Taliban are hardline Sunni Islamists, they are at times also bitter foes - with each claiming to be the true flag-bearers of jihad.

Students attend class at a government middle school in Kabul

Last week's suicide bombing at the airport was one of the deadliest bombings for civilians in Kabul in recent years, and led to the worst single-day death toll for the US military in Afghanistan since 2011.

The IS threat has forced the US military and the Taliban to cooperate in ensuring security at the airport in a way unthinkable just weeks ago.

The Taliban have already started taking over areas vacated by US forces.

Taliban leader

The Taliban have promised a softer brand of rule compared with their first stint in power, which the US military ended because the group gave sanctuary to al-Qaeda.

But many Afghans fear a repeat of the Taliban's brutal interpretation of Islamic law, as well as violent retribution for working with foreign militaries, Western missions or the previous US-backed government.

On Sunday, the Taliban revealed their supreme leader Hibatullah Akhundzada was in southern Afghanistan and planning to make a public appearance.

"He is present in Kandahar," said Taliban spokesman Zabihullah Mujahid, referring to the movement's spiritual birthplace.