The Ministry of Interior (MoI) said the incident took place late on Wednesday night in the central capital of Logar province.
According to a statement by MoI, an Improvised Explosive Device (IED) went off prematurely while the militants were planting it in Dawood Khel area, killing all seven miltants, including th commander of the group.
The statement further added that the Taliban commander killed in the explosion was a prominent leader of the group in Logar and was identified as Abdul Rauf.
The Taliban militants group has not commented regarding 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.