At least seven people including a prominent Somali official have been killed in a bomb attack by al-Shabab fighters in the capital Mogadishu.

The blast killed Abdikafi Hilowle, a police official and former secretary-general of the Mogadishu region, and wounded 25 people, medical officials said.

Police officer Mohammed Duale told the AFP news agency three policemen and four civilians were also among the dead.

Somalia's al-Shabab rebels claimed responsibility for the attack, branding Hilowle "an enemy of Allah" and accusing him of working with foreign intelligence services.

Al-Shabab's spokesman Abdiaziz Abu Musab told AFP "He was the enemy of Allah sought for crimes he committed against young Muslims, we are happy finally we killed him."

The spokesman warned "many others are on the list to be eradicated."

Security sources said the explosion may have been caused by a remote-controlled bomb attached to the car of Hilowle.

The blast came hours after Somali police foiled an attempt on the life of a Somali legislator who planted a bomb in his car.

Security forces removed the bomb and detonated it after they were tipped off, according to Captain Mohamed Hussein, a senior police official.

The attack is the latest in a string of bombings in the city attributed to al-Shabab rebels who are battling to overthrow the war-torn country's internationally-backed but fragile government.

The al-Shabab have been driven out of fixed positions in Somalia's major towns by a UN-mandated African Union force, but still regularly launch attacks that include bombings and guerrilla-style raids.

Recent al-Shabab attacks have targeted key areas of government or the security forces, in an apparent bid to discredit claims by the authorities that they are winning the war against the Islamist fighters.

Source: AFP