A local resident quoted witnesses on Sunday as saying that a man opened fire on a security guard who tried to stop him entering the mosque then blew himself up inside.

Khawaja Basharat, a Shia community leader, said seven people, some of them children, had been killed.

The bomber shot and killed two guards when they stopped him, Basharat added.

"As soon as he entered, he blew himself up. The casualties could have been greater if the guards hadn't tried to stop him. He could not reach the prayer hall, the bravery of the guards saved many lives," he said.

Sectarian violence

An official from the private Edhi emergency service said three or four bodies had been taken out of the mosque and some people had been wounded.

The attack was the latest sectarian violence to hit Pakistan in recent days that has fuelled fears of a flare-up in sectarian violence between minority Shia and majority Sunni Muslims.

The attack has raised fears of an
increase in sectarian violence

Earlier on Sunday, protesting students threw stones at police, who replied with tear gas in the southern city of Karachi ahead of the funeral of a leading pro-Taliban cleric and an associate gunned down by unknown men on Saturday.

Those killings followed two deadly attacks on religious gatherings this month in which more than 70 people, both Sunnis and Shias, died.

A car bomb attack on a crowd of Sunni Muslims in the
city of Multan on Thursday killed at least 42 people and a 
human bombing at a crowded Shia mosque killed 30 in the
city of Sialkot on 1 October.

Shia make up about 15% of Pakistan's 150 million people.