The withdrawal of US troops from Afghanistan will be finalized by the end of next month, the White House said Friday.

“We expect it to be completed by the end of August,” AFP quoted press secretary Jen Psaki as saying.

President Joe Biden had set a deadline of September 11 for the final pullout of the few remaining troops following 20 years of war, and a US defense official confirmed earlier Friday that all US troops had left Bagram Air Base, the biggest in Afghanistan.

“The president has long felt that the war in Afghanistan was not one that can be won militarily,” she was quoted as saying by AFP. She also added that the United States would continue to provide security systems and humanitarian assistance in the months ahead.

The US military and NATO are in the final stages of winding up involvement in Afghanistan, bringing home an unspecified number of remaining troops by Biden’s deadline.

The Taliban have launched relentless offensives across Afghanistan in the past two months, gobbling up dozens of districts as Afghan security forces have largely consolidated their power in the country’s major urban areas.

At the White House, Biden responded to concerns that the internationally backed Afghan government might quickly crumble to Taliban insurgents once its foreign backers leave, saying they “have the capacity to be able to sustain government down the road.”

The US military is keeping an “over the horizon capacity” which could bring firepower to help the government, but the “Afghans are going to have to be able to do it themselves.”

Media reports say the Pentagon will probably retain about 600 US troops in Afghanistan to guard the vast US diplomatic compound in Kabul.