A suicide car bomb has killed at least five people in an attack at the entrance of the Somali parliament, witnesses told Al Jazeera.
The blast on Saturday killed at least three soldiers and two civilians, a source at the scene said. A sixth person was shot dead by soldiers as he drove past the attack, the source added.
Abdi Barre, an MP who was in the parliament building and who also witnessed the attack, told Al Jazeera: "It was a large explosion. A suicide car bomb. There are casualties."
Ridwaan Haji, a Somali government spokesman, told Al Jazeera: "Three soldiers were killed and two others injured. A number of civilians have also been injured and investigations are underway."
Al-Shabab, the rebel group fighting the UN-backed Somali government, said it carried out the attack.
"This is our second attack against the parliament building and we shall continue it," Sheikh Abdiaziz Abu Musab, al-Shabab's spokesman for military operations told Reuters news agency.
The UN condemned the latest attack by the al-Qaeda-linked group.
"Another senseless attack in Mogadishu close to parliament. I condemn it strongly. Our will to help Somalis build peace is even stronger," Nick Kay, the UN special representative for Somalia, said on Twitter.
Al-Shabab gunmen and suicide bombers killed 10 people in an attack on the parliament in May.
Al-Shabab killed Mohamed Mohamud Hayd, a senior MP, and wounded another politician in a drive-by shooting in the Somali capital on Thursday. Hayd was the fourth politician killed by the group this year.
Follow Hamza Mohamed on Twitter: @Hamza_Africa