Somali police evacuate an injured colleague from the scene of a suicide car bomb near the KM4 building in Hodan district, south of the capital Mogadishu
Somali police evacuate an injured colleague from the scene of a car bomb in Somalia. REUTERS

Somalia's parliament building in Mogadishu has been rocked by two huge explosions while MPs were in session.

Heavy gunfire followed the blasts and at least four bodies are reported to have been recovered near the site.

Police official Husein Ise told the AFP news agency: "There is an attack near the parliament building. There was a car bomb explosion and gunfire broke out. We don't have details so far."

Local eyewitnesses said the al-Qaida-linked Somalian militant group al-Shabaab appeared to have carried out an attack on the parliamentary complex while politicians were in a meeting.

Al-Shabaab has waged a campaign of terror in its attempt to overthrow Somalia's internationally backed government.

Somalia's first parliament since the collapse of the national government was sworn in two years ago and the fragile government has continued to wage war on al-Shabaab insurgents.

The group admitted that it was behind last September's attack on the Westgate shopping mall in Kenya's capital Nairobi, which killed at least 67 people and wounded 175.

The militant group said the attack was carried out in retaliation for Kenyan forces coordinating anti-militant operations in neighbouring Somalia.

Al-Shabaab was pushed out of Mogadishu in 2011 but has continued to wage a sustained guerrilla campaign, claiming responsibility for a series of suicide bomb attacks in the city.

The parliament in Mogadishu, which operated a transitional assembly from 2004 to 2012, has been attacked several times, notably in 2009 and 2010.

Earlier this month, al-Shabaab claimed responsibility for an attack in Mogadishu that killed six people, including senior city official Abdikafi Hilowle Osman, a former member of the local government in the capital city.

Last month, the group admitted to killing two parliamentary delegates in a gun and car bomb attack, and in February, al-Shabaab militants killed officials and guards in an attack on Mogadishu's heavily guarded presidential palace.