President Joe Biden will formally announce Wednesday the withdrawal of all US troops from Afghanistan before this year's 20th anniversary of the September 11 attacks, finally ending America's longest war despite mounting fears of a Taliban victory, officials said.

The drawdown delays only by around five months an agreement with the Taliban by former president Donald Trump to pull troops, amid a growing consensus in Washington that little more can be achieved. The decision came as Turkey announced an international peace conference on Afghanistan in hopes of reaching an agreement that brings stability to a nation battered by nearly 40 years of war.

But the Taliban, newly emboldened, said they would boycott the conference.

Biden, who will make a formal announcement on the US plans later Wednesday, had earlier mused about keeping a residual force to strike at Al-Qaeda or an emergent Islamic State extremist threat, or making withdrawal contingent on progress on the ground or in slow-moving peace talks.

In the end, he decided to do neither and will order a complete withdrawal other than limited US personnel to guard the US installations -- including the imposing embassy in Kabul, a senior official said.

"The president has judged that a conditions-based approach, which has been the approach of the past two decades, is a recipe for staying in Afghanistan forever," the official told reporters on condition of anonymity.

US Secretary of State Antony Blinken said the moment had arrived to bring forces back home, and Washington would work out a "coordinated" withdrawal plan with its NATO allies.

"Together, we have achieved the goals that we set out to achieve and now it is time to bring our forces home," Blinken said ahead of talks with NATO partners in Brussels.

German Defence Minister Annegret Kramp-Karrenbauer said Wednesday that NATO would likely join the US in withdrawing its troops by September.

"We always said: we'll go in together, we'll leave together," she told ARD public television.

The Times newspaper said Britain would withdraw its roughly 750 troops, citing sources as saying "they would struggle without American support because of a reliance on US bases and infrastructure." The government did not deny the report.

Under the Trump administration's February 2020 deal with the Taliban, all US troops were to leave by May 2021 in return for the insurgents' promise not to back Al-Qaeda and other foreign extremists -- the original reason for the 2001 invasion.

The Biden official said the withdrawal would begin in May and that the delay was largely logistical, with troops possibly out of Afghanistan well before September 11.

The official warned the Taliban -- who are observing a truce with US but not with Afghan forces -- not to strike coalition forces as they leave, saying that in response to any attack "we will hit back hard."

Fighting will likely grind on. A threat assessment report published Tuesday by the director of national intelligence said the Taliban "is confident it can achieve military victory."

Afghan civilians have long paid a disproportionate price in the fighting, and the rise of the Taliban has raised particular fears among Afghan women.

The Taliban, who enforce an austere brand of Sunni Islam, banned women from schools, offices, music and most of daily life during their 1996-2001 rule over much of Afghanistan. Two decades later, 40 percent of schoolchildren are girls.

The Biden official said the United States would use non-military "tools at our disposal" to promote women's rights including bolstering civilian assistance. Biden's decision came as Turkey said it will host a US-backed peace conference from April 24 to May 4 that would bring together the Afghan government, the Taliban and international partners.

It aims to achieve some kind of a political settlement and an "end to the conflict," the Turkish foreign ministry said.

But Mohammad Naeem, spokesman for the Taliban office in Qatar, said the insurgents will not participate in any conference on Afghanistan's future "until all foreign forces completely withdraw from our homeland."

Many observers believe that the Taliban think they have already effectively won and can wait out the US withdrawal. A decade ago, the United States had about 100,000 troops in Afghanistan as part of a "surge" strategy by then-president Barack Obama to defeat the Taliban.

The troop figure by the end of Trump's presidency had gone down to 2,500 as support for military action waned. As of February this year, NATO had around 10,000 troops in Afghanistan. Even onetime backers of the war have voiced concern about limited gains on the ground as well as infighting and corruption in Kabul, and questioned whether the $2 trillion spent in Afghanistan could have had better uses at a time of growing alarm about China.

Senator Tim Kaine, an ally of Biden, said the United States accomplished a primary goal 10 years ago by killing Osama bin Laden and it was time to "refocus American national security on the most pressing challenges we face."

But Representative Mike McCaul, the top Republican on the House Foreign Affairs Committee, said the withdrawal means "abandoning our Afghan partners during critical peace negotiations and allowing the Taliban a total victory."