The US has admitted that a drone strike in Kabul days before its military pullout killed 10 innocent people.
A US Central Command investigation found that an aid worker and nine members of his family, including seven children, died in the 29 August strike.
The youngest child, Sumaya, was just two years old.
The deadly strike happened days after a terror attack at Kabul airport, amid a frenzied evacuation effort following the Taliban's sudden return to power.
It was one of the US military's final acts in Afghanistan, before ending its 20-year operation in the country.
US intelligence had tracked the aid worker's car for eight hours, believing it was linked to IS-K militants - a local branch of the Islamic State (IS) group, US Central Command Gen Kenneth McKenzie said.
The investigation found the man's car had been seen at a compound associated with IS-K, and its movements aligned with other intelligence about the terror group's plans for an attack on Kabul airport.
At one point, a surveillance drone saw men loading what appeared to be explosives into the boot of the car, but these turned out to be containers of water.
Gen McKenzie described the strike as a "tragic mistake", and added that the Taliban had not been involved in the intelligence that led to the strike.
The strike happened as the aid worker - named as Zamairi Ahmadi - pulled into the driveway of his home, 3km (1.8 miles) from the airport.
The explosion set off a secondary blast, which US officials initially said was proof that the car was indeed carrying explosives. However the investigation has found it was most likely caused by a propane tank in the driveway.
One of those killed, Ahmad Naser, had been a translator with US forces. Other victims had previously worked for international organisations and held visas allowing them entry to the US.
Relatives of the victims told the BBC the day after the strike that they had applied to be evacuated, and had been waiting for a phone call telling them to go to the airport.
In a statement, Defense Secretary Lloyd Austin said: "We now know that there was no connection between Mr Ahmadi and Isis-Khorasan, that his activities on that day were completely harmless and not at all related to the imminent threat we believed we faced.
"We apologise, and we will endeavour to learn from this horrible mistake."
The horrific consequences of the US military's miscalculation have drawn questions about the accuracy of future counter-terrorism operations in Afghanistan with a US presence no longer on the ground.
This catastrophe exposed the dreadful human cost of a war that inflicted a lot of damage from the air for years.
That it should take place just as the Americans ended their 20-year occupation will cast an even darker stain on the chaotic US exit.
But for some in the region, it is a particularly stark example of the ongoing dangers of drone warfare.
When the US started to withdraw its troops from Afghanistan, the Taliban managed to seize control of the country within about two weeks in a lightning-fast offensive.
President Ashraf Ghani fled to the United Arab Emirates, and Afghanistan's capital, Kabul, fell on 15 August.
It sparked a mass evacuation effort from the US and its allies, as thousands of people tried to flee. Many were foreign nationals or Afghans who had worked for foreign governments.
There were scenes of panic and chaos at Kabul airport, and some people fell to their deaths after trying to cling to US military planes as they took off.
The security situation was further heightened after a suicide bomber killed up to 170 civilians and 13 US troops outside the airport on 26 August. IS-K said it had carried out the attack.
Many of those killed had been hoping to board evacuation flights leaving the city.
The last US soldier left Afghanistan on 31 August - the deadline President Joe Biden had set for the US withdrawal.
More than 124,000 foreigners and Afghans were flown out of the country beforehand. But some people were unable to get out in time, and evacuation efforts are ongoing.