A gunman opened fire in a mosque during Friday night prayers, in the Sudanese city of Um Darman, killing 20 people and injuring at least 40 others.
The gunman was then shot and killed by police, Sudanese state television reported.
The attacker, identified as Abbas al-Baker Abbas was a member of an Islamic militant group called Takfir wal Hijra.
He walked into the mosque in the village of Garaffa, outside Om Durman, the twin city of the capital Khartoum, and began firing an automatic rifle.
Police rushed to the al-Sunna al-Mohammediyya Mosque and shot the gunman after he refused to surrender.
The motive for the attack was not immediately known, but Takfir wal Hijra has targetted al-Sunna al-Mohammediyya, a rival Muslim sect, in the past.
The name Takfir wal Hijra literally means "Repentance and Flight," referring to flight from the sinful world.
The name was used in Egypt in the early 1970s by a violent offshoot of the Muslim Brotherhood, since then the name has periodically been used by groups in other Arab countries.
Reports from Sudan were confused, with state television reporting one gunman involved in the shooting, while eyewitnesses talk of a group of men opening fire.
General Abdul Rahim Mohammad Hussein, a government minister visited the scene of the massacre before holding a meeting with other high ranking officials.
"I am a police officer, I was on duty in the Jarafa area and I was wounded with a shotgun in my left hand, from a ricochet. We saw a group of armed people wearing a jalabia (traditional Sudanese dress) with a black waistcoat, and they started shooting at us and we responded by shooting at them, and the firing continued between both sides. Our police car was hit by bullets and I saw six dead citizens, and I don't know how many injured."