MAZAR-I-SHARIF, Afghanistan — After the second firefight in the past 10 days between American soldiers and their Afghan allies, at least 14 civilians, most of them women and children, were killed in an airstrike on Saturday in northern Kunduz province, according to Afghan officials. At least four Afghan soldiers were also killed.

A spokeswoman for the American military confirmed the attack, but blamed the outcome on the Taliban.

“We are fighting in a complex environment and this firefight is a prime example of the challenges Afghan and coalition forces face every day,” said Sgt. 1st Class Debra Richardson. “The Taliban were hiding in civilian homes and maneuvered in and out of compounds without any concern for the families living inside.”

The episode on Saturday came a day after two members of an American Special Forces unit and four Afghan Special Forces soldiers were killed during a joint operation in Gul Tepa District, on the outskirts of Kunduz city, and involved some of the same forces, according to Afghan official accounts. The insurgents were reportedly massing on the outskirts of the city, which they have twice overrun, in 2015 and in 2016.