At least 50 civilians have been killed by militants in northern Afghanistan, officials say.
They report that a checkpoint manned by local police was attacked on Thursday in the Mirzawalang area of Sar-e Pul province.
The assailants then entered a nearby village and shot dead mainly Shia Muslim civilians including women and children, a provincial spokesman said.
"They were killed in a brutal, inhumane way," he added.
Seven members of the Afghan security forces had also been killed, as well as a number of insurgents, he said.
The attack took place over 48 hours and the area was now under insurgent control, local officials said.
A combination of Taliban and Islamic State (IS) group fighters - including foreigners - were involved, a spokesman said. Both are Sunni Muslim militant groups.
The Taliban denied killing civilians, saying that their fighters had killed 28 members of a government-supported militia in the area. There has been no comment from IS.
If verified, it would be rare co-operation between the two groups. IS established a small base in eastern Afghanistan in 2015 and in general its fighters have clashed with the Taliban in a competition for control.
But, correspondents say, in the north of the country allegiances can be more fluid, with some fighters switching sides or co-operating with other groups.
A Taliban spokesman told AFP news agency there had been no co-operation with IS, however.
Afghan President Ashraf Ghani condemned the attack.
"Criminal terrorists have once again killed civilians, women and children," he said in a statement on Sunday.
"This barbaric act of them is deemed a direct violation of human rights and a war crime."
Fighting has intensified across Afghanistan in recent months. More than 1,662 civilians were killed in the half of the year, according to UN figures.
US President Donald Trump is considering whether to increase the number of US troops aiding the military and police in the country.
Very saddened by the attack on innocent civilians in Sayad District of Sar-e-Pul Province. Killing civilians is insane, inhuman & barbaric!— Dr. Abdullah (@afgexecutive) August 6, 2017