Ten police officers and the wife of a commander have been killed in an ambush outside a mosque by Taliban fighters in northern Afghanistan.

Mohammad Reza Ghafori, spokesman for the Jowzjan provincial governor, said on Saturday the police officers were attacked on Friday as they were coming out of the mosque.

The wife of the police commander heard about her husband being shot and rushed to the scene, where she was also killed in Sardar village of Darzab district, Ghafori said.

Officials blamed the Islamic State of Iraq and the Levant (ISIL) for the deadly attack.

However, Zabihullah Mujahid, a spokesman for Taliban, said on Twitter his group killed the policemen and captured the village.

It was not possible to independently confirm either claim.

ISIL-linked fighters have been active in Afghanistan's eastern regions, but have recently begun operating in the north of the country as well.

In Jowzjan province earlier this month, ISIL was blamed for killing at least six Afghan employees of the International Committee of the Red Cross who were carrying supplies to areas hit by deadly snowstorms. Another two staff remain unaccounted for.