President Joe Biden formally announced Wednesday that he will withdraw all the U.S. troops in Afghanistan by the upcoming 20th anniversary of the Sept. 11 terror attacks, saying it is "time to end America's longest war."

"The United States will begin our final withdrawal beginning on May 1," Biden said in a speech at the White House, adding, "We will not conduct a hasty rush to the exit."

"We will do it responsibly, deliberately and safely, and we will do it in full coordination with our allies and partners who now have more forces in Afghanistan than we do," he said.

U.S. President Joe Biden at the White House in Washington. (UPI/Kyodo)

The United States sent troops into Afghanistan in 2001 against the al-Qaida organization and the Taliban, which harbored the group, in the wake of the Sept. 11 terror attacks.

Although the U.S.-led forces toppled the Taliban regime through the military invasion in Afghanistan, war has continued amid the Taliban insurgency.

Biden said the United States has achieved an initial objective of its military campaign to ensure Afghanistan would "not be used as a base from which to attack our homeland again," such as through the 2011 killing of Osama bin Laden, the mastermind behind the terror attacks.

"We delivered justice to bin Laden a decade ago, and we've stayed in Afghanistan for a decade since. Since then, our reasons to remain in Afghanistan become increasingly unclear even as the terrorist threat that we went to fight evolved," Biden said, noting that such attacks have become more dispersed around the globe.

"I've concluded that it is time to end America's longest war. It is time for American troops to come home," he said.

Afghan Taliban fighters and villagers attend a gathering as they celebrate the peace deal signed between the United States and taliban in Laghman Province, Alingar district on March 2, 2020. (NurPhoto/Getty/Kyodo)

But the United States will continue its diplomatic and humanitarian work while supporting peace talks between the Afghan government and the Taliban, facilitated by the United Nations, he added.

A full withdrawal of American troops by May 1 was agreed last year under a peace deal reached between the previous administration of President Donald Trump and the Taliban militants. But Biden, who took office on Jan. 20, had expressed the difficulty of realizing the timeline.

The United States currently has 2,500 troops in the war-torn country, part of the 9,600-strong mission led by the North Atlantic Treaty Organization. NATO said in a statement on Wednesday that allies will start withdrawing from Afghanistan by May 1.

Australia said Thursday it will also withdraw its final 80 troops left in the country, by September, with Prime Minister Scott Morrison saying the move "represents a significant milestone in Australia's military history."

U.S. forces in Afghanistan were reduced to the lowest level since 2001 during the Trump administration.