US President Joe Biden has defended his decision to withdraw US troops from Afghanistan - a move which led to Taliban militants returning to power.
Staying longer was not an option, Mr Biden said in an address to the nation, a day after the end of a 20-year US presence in Afghanistan.
He praised troops for organising an airlift of more than 120,000 people wishing to flee the Taliban regime.
The Islamist militants have been celebrating what they call a victory.
US-led troops went into Afghanistan in 2001, ousting the Taliban in the wake of the devastating 9/11 attacks, blamed on al-Qaeda - a militant jihadist group then based in the Asian country.
Mr Biden has been widely criticised - at home and by his allies - over the abrupt manner of the US withdrawal, which led to the unexpected collapse of the Afghan security forces US troops had trained and funded for years.
Taliban militants were able to reclaim control of the whole country within 11 days - finally entering the capital, Kabul, on 15 August.
President Biden deployed nearly 6,000 troops to seize control of the airport to co-ordinate the evacuation of US and allied foreign nationals and local Afghans who had been working for them.
Thousands of people converged on Kabul international airport in the hope of being able to board one of the evacuation flights.
In Tuesday's address, Mr Biden praised troops for the mass evacuation and promised to continue efforts to bring out those Americans who were still in Afghanistan and wanted to return - about 200 people altogether.
"A lot of our veterans and their families have gone through hell," he said. "Deployment after deployment. Months and years away from their families... loss of limbs, traumatic brain injury, post-traumatic stress."
"I was not going to extend this forever war, and I was not extending a forever exit," Mr Biden said, adding: "The war in Afghanistan is now over."
He said the US did not need troops on the ground to defend itself.
The president later said his decision was "not just about Afghanistan". "It's about ending an era of major military operations to remake other countries," he tweeted.
line
Analysis box by Anthony Zurcher, North America reporter
Joe Biden tried to "turn the page" from a month of chaos and death in Afghanistan and, more broadly, from 20 years of ultimately futile US attempts at occupation and nation-building.
At times he seemed defensive, noting that Americans were warned 19 times to exit Afghanistan before the August US military withdrawal. He accused Afghan leaders, allies on whom the US had depended, of "corruption and malfeasance". And he blamed the Trump administration for negotiating what he characterised as an inadequate withdrawal agreement with the Taliban.
He said the US had no vital interest in Afghanistan, and tried to reframe US foreign policy as depending less on military deployments and more on diplomacy and international cooperation to face adversaries like China and Russia.
Public opinion polls show Americans still support the US withdrawal from Afghanistan, although many are unhappy with how Biden oversaw the exit. White House officials say they hope, as time passes, that the nation will be grateful for what the president accomplished and forget the details of how it ended.