Mr. Saadi also said that the event was religious in nature and that the security forces had decided to attack because armed militants were in attendance.

However, Brig. Gen. Mohammad Radmanish, a spokesman for the Defense Ministry denied that the gathering had been for religious purposes. “The Taliban and other insurgent groups were planning to attack Afghan forces, but their plan was discovered by our forces,” he said.

“During the attack by our helicopters, 21 terrorists, including a Taliban commander, have been killed,” he added. “It isn’t a residential area, and only terrorists and the Taliban were active in the place. There wasn’t any civilian in the area.”

Nonetheless, witnesses said that children and other civilians were among the victims.

The district of Dasht-e-Archi is a Taliban stronghold that has often been the scene of heavy fighting. In May, an American drone strike in the district killed Mullah Abdul Salam, the Taliban “shadow governor” of Kunduz.

In 2016, an Afghan airstrike killed another prominent Taliban commander, Mawlavi Muawiyah, in Dasht-e-Archi, along with 21 other fighters, according to the military. American airstrikes in the area have repeatedly been blamed for civilian casualties, and Afghan forces are increasingly taking over air operations there.