According to the security officials, the militants were busy making the IED inside a mosque in Andar district.
The officials further added that the explosives went off prematurely, leaving all 10 militants dead.
The anti-government armed militant groups have not commented regarding the report so far.
The Taliban insurgents and militants belonging to the other insurgent groups are frequently using Improvised Explosive Device (IED) as the weapon of their choice to target the security forces.
The IEDs are the main contributors to the casualties of the Afghan security forces but are also considered as a key factor in growing civilian casualties.
At least 600 civilians were killed and 1,343 others were wounded in the first quarter of 2016, the United Nations Assistance Mission in Afghanistan said in its latest report.
UNAMA further added that consistent with 2015 trends, ground engagements caused the highest number of total civilian casualties, followed by improvised explosive devices (IEDs), complex and suicide attacks, as well as targeted killings.
According to UNAMA, actions by Anti-Government Elements caused at least 60 per cent of casualties while Pro-Government Forces caused at least 19 per cent.