At least two policemen were killed and eight wounded in the blast and ensuing fighting, the Afghan Ministry of Interior said.
After their armored vehicles came under fire as they tried to enter from the front entrance, one police officer said, the forces sought to gain access through homes behind the mosque, even as residents tried to flee with their families. On Aug. 1, the group attacked a Shiite mosque in the western city of Herat during evening prayer, killing nearly 40.
Police were promptly deployed at the site in a northern Kabul neighborhood and encircled the mosque.
Last month, the group attacked the Iraqi Embassy in Kabul and afterward issued a warning to all Shiites in Afghanistan, saying their places of worship would be targeted.
Police official, Mohammed Jamil, says the gunmen are still inside the mosque, which was crowded with worshippers bowed in Muslim Friday prayers.
Witnesses said that gunmen threw grenades and then entered the mosque.
Taliban attacked a security outpost in southern Kandahar province, the insurgents' former heartland, killing four troops on Friday.
He said at least thirty civilians, 7 personnel of the special forces of the police forces, and a personal of the public order police forces were among those wounded. It did not give further details.
"The second attacker was gunned down by Afghan security forces", Mujahid added.
This comes as the Taliban group had earlier rejected role in the attack.