The blast went off in the Guzargah Mosque in Herat during Friday noon prayers.
“Mujib Rahman Ansari, with some of his guards and civilians, have been killed on their way toward the mosque,” said Herat’s police spokesperson Mahmood Rasoli.
Rasoli did not say how many casualties the blast caused.
Sources at the scene told Al Jazeera that 15 people had been killed.
There was no immediate claim of responsibility. Videos and images on social media showed what appeared to be blood-stained bodies scattered around the mosque compound.
Taliban official Abdul Nafi Takor confirmed Friday’s explosion and said there were dead and wounded, but had no further details.
Mujib Rahman Ansari had spoken strongly in defence of the Taliban at a large gathering of thousands of scholars and elders organised by the group in late June, condemning anyone who stood against their administration.
The Taliban say they have improved security in the country since taking power around a year ago, but there have been several blasts in recent months, some of them targeting busy mosques during prayers.
Previous mosque attacks have been claimed by the armed group Daesh, which has carried out a series of assaults against religious and ethnic minorities in Afghanistan, as well as Taliban targets.