MOGADISHU, Somalia — Five people died and six others were wounded when a bomb exploded in Mogadishu, Somalia’s capital, an official said Saturday.

A top police officer, who was the apparent target of the attack, was among the five killed, said Capt. Mohamed Hussein, a senior police official.

Somalia’s Islamic extremist rebels, al-Shabab, claimed responsibility for the attack which killed police officer Abdikafi Hilowle.

The Al-Qaida-linked al-Shabab militants are waging an insurgency against Somalia’s weak, U.N.-backed government.

Al-Shabab has resorted to terror attacks in Somalia’s capital, Mogadishu, since African Union troops backing the Somali government pushed the militants from the city in 2011. Somalia is struggling to rebuild after decades of conflict following the ouster of the dictator Siad Barre in 1991.

Saturday’s blast came hours after Somali police foiled an attempt on the life of a Somali legislator when suspected militants planted a bomb in his car. Security forces removed the bomb and detonated it after they were tipped off, according to Hussein.

Two Somali legislators were killed late April in gun and explosive attacks which were claimed by al-Shabab.

The targeting of members of parliament appears to be a new strategy for al-Shabab. The parliament is emerging as a pillar of democracy in the Horn of Africa nation.

Al-Shabab militants have previously carried out attacks against United Nations staff, government officials and African Union peacekeepers. Last year al-Shabab also killed 67 people in an attack an upscale mall in Nairobi, in the capital of neighboring Kenya which has sent troops into Somalia to battle al-Shabab.