US President Joe Biden has announced that the US military mission in Afghanistan will end on 31 August, nearly 20 years after it began.

The US military has "achieved" its goals in the country to degrade Al-Qaeda and prevent more attacks on the United States, Mr Biden said in a speech.

"We are ending America's longest war," he added.

"The status quo is not an option," he said of staying in the country. "I will not send another generation of Americans to war in Afghanistan."

He said the US "did not go to Afghanistan to nation-build … it is the right and the responsibility of the Afghan people alone to decide their future".

Mr Biden pledged to continue supporting the Afghan government and security forces.

He said that thousands of Afghan translators who worked for US forces and face threats from the Taliban insurgents would be able to find refuge in the United States.

"There is a home for you in the United States, if you choose," he said. "We will stand with you, just as you stood with us."

Mr Biden said he was confident the Afghan armed forces could stand up to the Taliban, who have made strong advances across the country since the beginning of the year.

He also said a takeover of the government by the Taliban is not inevitable. "I trust the capacity of the Afghan military," he said.

Elsewhere, British Prime Minister Boris Johnson said most of the remaining British troops assigned to the NATO mission in Afghanistan have left, with the rest to come home shortly.

"All British troops assigned to NATO's mission in Afghanistan are now returning home ... I will not disclose the timetable of our departure, but I can tell the house that most of our personnel have already left," he said in a statement to MPs.

Mr Johnson yesterday said he was "apprehensive" about the future of Afghanistan.

He stressed to MPs that it would take "the combined effort of many nations, including Afghanistan's neighbours, to help Afghanistan build their future".

"But the threat that brought us to Afghanistan in the first place has been greatly diminished by the valour and the sacrifice of the armed forces of Britain and many other countries," he said.

"We are safer because of everything they did."

A total of 457 British troops died in action in Afghanistan after the country joined the US-led coalition intervention after the 11 September, 2001 attacks in New York and Washington.