There had been fears insurgents would strike as Shiites

Up to six people were killed when a suicide bomber posing as a shepherd blew himself up near a Shiite mosque in Kabul on Friday, police said, as Muslims prepare to commemorate a key Islamic event.

As many as 20 others were wounded in the attack, which happened in the north of the Afghan capital as worshippers were inside Hussainia mosque, one of the biggest Shiite centres in the city, for Friday prayers.

"The bomber was grazing a herd of sheep and before reaching his target he detonated himself 140 metres from Hussainia mosque," General Salim Almas, Kabul's criminal investigative director, told AFP.

Interior ministry spokesman Najib Danish said on Facebook that five civilians were killed and 20 others were wounded. Three suspects have been detained. 

Kabul's Emergency hospital tweeted that it had received 19 wounded including four children.

A photo posted on Twitter purportedly taken at the scene of the attack shows a man lying on the ground, covered in blood. A severed leg belonging to someone else is beside him.

There was no immediate claim of responsibility, but following the attack the Taliban were quick to distance themselves from the bombing. 

"Today's Kabul attack has nothing to do with us. After a thorough investigation we found out that we had no operation in Kabul, and this attack is not linked to us," Zabihullah Mujahid, a Taliban spokesman, told AFP.

In the past Taliban and Islamic State jihadists, who belong to the rival Sunni branch of Islam, have repeatedly targeted the minority Shiite community.

A shopkeeper told AFP that the suicide bomber blew himself to bits after he was identified by suspicious civilian guards who had set up a checkpoint about 200 metres (yards) from the mosque.

Afghanistan has trained and armed more than 400 civilians to help protect Shiite mosques during the holy month of Muharram.

The attacker had apparently wanted to reach the mosque while worshippers were still inside the prayer hall.

- Children wounded -

Afghan security forces patrolled the dirt street where the attack happened. Nearby shops, most of which would have been closed on a Friday, were damaged by the blast.

Salim Shaheen, who was inside the mosque at the time of the explosion, told AFP there were multiple casualties.

"We were busy offering our Friday prayers when a big bang happened and we stopped prayers and rushed out," Shaheen said.

Shaheen said "several people were killed and wounded". He and other bystanders took 15 people including six children to hospital.

There had been fears insurgents would strike as Shiites prepare to commemorate Ashura, which falls this weekend and is the most important Shiite observance.

It falls on the 10th day of Muharram, which is the mourning period for the seventh-century killing of Imam Hussein, the grandson of the Prophet Mohammed.

The faithful gather to beat their chests and hit their backs with chains until they bleed in commemoration of Hussein's death.

But in recent years the sacred day has been marred by deadly violence.

In 2011 a suicide bomber detonated his explosives in the middle of a crowd of worshippers at the main Shiite shrine in Kabul on Ashura, killing 80 people, including women and children.

Afghan officials blamed the bombing -- the first major sectarian attack on a key religious day in Afghanistan -- on Pakistani group Lashkar-e-Jhangvi.

Last October gunmen entered the Karte Sakhi shrine near Kabul University and killed 18 people gathering to mark Ashura, an attack claimed by the Islamic State.

The following day at least 14 Shiites were killed in a bombing at a mosque in northern Afghanistan. A few weeks later Baqui ul Ulom mosque in Kabul was targeted when a massive suicide blast claimed by IS killed dozens of worshippers.