A drone strike in Kabul last month that killed as many as 10 civilians, including seven children, was a "tragic mistake", the US military has admitted.
The Pentagon had said the 29 August strike targeted an Islamic State suicide bomber who posed an imminent threat to US-led troops at the airport as they completed the last stages of their withdrawal from Afghanistan.
Even as reports of civilian casualties emerged, a US general had described the attack as "righteous".
"At the time of the strike, I was confident that the strike had averted an imminent threat to our forces at the airport," Marine Corps General Frank McKenzie, head of US Central Command, told reporters.
"Our investigation now concludes that the strike was a tragic mistake."
He said he now believed it unlikely that those killed were members of the local Islamic State affiliate, ISIS-Khorasan, or posed a direct threat to US forces.
The Pentagon was considering reparations, General McKenzie said.
In a statement, US Defense Secretary Lloyd Austin apologised for the strike.
"I offer my deepest condolences to surviving family members of those who were killed," he said. "We apologise, and we will endeavor to learn from this horrible mistake."
Mr Austin said the drone strike had killed a Mr Ahmadi who worked for a non-profit called Nutrition and Education International.
"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," the Defense Secretary said in the statement.
While it is rare for senior Pentagon officials to apologise personally for civilians killed in military strikes, the US military does put out reports on civilians killed in operations around the world.
Reports had emerged almost immediately that the drone strike had killed civilians including children.
A spokesman for Afghanistan's new Taliban rulers, Zabihullah Mujahid, had said at the time that the attack had killed seven people.