KABUL, Afghanistan — Two boys out collecting firewood with their donkeys were killed by weapons fired from a NATO helicopter, Afghan and American military officials announced Saturday.

The new American commander in Afghanistan, Gen. Joseph F. Dunford Jr., promptly issued an apology and said the killings were an accident.

The victims, Toor Jan, 11, and Andul Wodood, 12, were brothers and had been walking behind their donkeys in the Shahed-e-Hasas district of Oruzgan Province when the helicopter fired on them, according to Afghan officials in the district. The two donkeys were killed as well.

General Dunford said that coalition forces had opened fire on what they thought were insurgent forces, and killed the boys by accident. “I offer my personal apology and condolences to the family of the boys who were killed,” General Dunford said. “We take full responsibility for this tragedy.”