“We live in a state of fear,” the elder said by telephone. “All of us who participated in the funeral are now scared that ISIS will attack and kill us.” The elder spoke on the condition of anonymity because he feared retaliation by militants. It was not clear if the seven police officers were counted among the 10 cited by the governor, or if they were additional casualties.

“ISIS is more powerful than the Taliban were in Darzab because their fighters are brave,” said Hajji Obaidullah, the former police chief of the district. He and other local officials said that two former Taliban commanders, Qari Hikmat and Mufti Nemat, had combined forces and switched their allegiance to the Islamic State in recent months. He said the government had rushed in hundreds of reinforcements, in the form of police officers and soldiers from other areas, to keep the district center from falling to insurgents.

“There is no Taliban in Darzab now, but only ISIS,” said Halima Sadaf, a member of the Jowzjan Provincial Council, who is from Darzab.

“They took over the district before Eid al-Fitr,” she said, referring to the holiday signifying the end of Ramadan that began on Sunday.

“But Afghan national security forces pushed them out of the capital of the district; the rest of the district is all with them,” she added. “They are strong and regrouping to launch another offensive.”

One of the Islamic State commanders, Mufti Nemat, was persuaded last year to quit the Taliban and join the government side after a heavily publicized intervention by General Dostum, the first vice president. Mufti Nemat was previously a religious teacher in General Dostum’s home village. He later accused the government and General Dostum of reneging on promises made to him, announcing that he was joining forces with Qari Hikmat and would support the Islamic State.

Spokesmen for General Dostum and for the Taliban both confirmed that Mr. Nemat had left the Taliban, joined General Dostum’s side, but then gone over to the ISIS camp. “Nemat is a threat for the government. He knows the Darzab District and the area very well; he is a very dangerous guy,” said Enayatullah Babur Farahmand, General Dostum’s chief of staff. He blamed government inaction for alienating Mr. Nemat.