KABUL, Afghanistan (AP) — The Taliban have released 235 villagers held since the insurgents seized control of an area in northern Sari Pul province five days ago, Afghan provincial officials said Wednesday.

Local authorities believe the capture of the area was jointly carried out by the Taliban and Islamic State militants. If confirmed, this will mark the first time the two rival militant groups have joined forces in battle.

The information was gleamed after some of the freed villagers told local media that they saw both the Taliban white banner and the Islamic State group's black flag flying together during the attack.

Zabi Amani, spokesman for the provincial governor, said the civilians were released after negotiations between the Taliban and tribal elders. The insurgents were still holding an unknown number of civilians, he said.

Most of the civilians are staying in local mosques and some are with relatives in the city, and provincial officials are trying to provide food and other necessities for them before finding a long-term solution, he added.

Amani also said that since the insurgents took control of the area, 52 civilians, including women and children, have been killed in the village of Mirzawalang in Sayad districts. The victims were mostly Shiites and minority Hazaras.

Qari Yusouf Ahmadi, a Taliban spokesman, confirmed the insurgents had seized the area but denied civilians were killed in Mirzawalang.

So far, the Islamic State group has not commented on the attack or said whether it had joined forces with the rival Taliban.

There have been reports of battles in the past months between the Taliban and the IS affiliate in Afghanistan in several provinces. Afghanistan's IS affiliate is made up mostly of disenfranchised Taliban.

In Sari Pul, the insurgents defeated Afghan local police forces after almost two days of intense fighting and took control of the area early on Aug. 5, Amani said. He vowed that Afghan security forces would begin an operation to retake the Mirawalang area soon.

Afghan President Ashraf Ghani condemned the killings in Sari Pul.

"I will promise that our brave security forces will take revenge," Ghani said during a ceremony at the presidential palace, broadcast live on TV.

Meanwhile, gunmen opened fire on a group of four women employees at the Bagram airfield, the main U.S. military base in the country, killing one and wounding a second woman, said Gen. Zaman Mamozai, the provincial police chief.

The attack took place on Wednesday afternoon near the U.S. base in Bagram district in Parwan province. Two of the four women escaped unhurt, added Mamozai.

No one immediately claimed responsibility for the shooting. In June, Taliban insurgents gunned down six Afghan security guards of the base while they were on their way to work for night shift duty.