Five soldiers and police were killed in the Somali capital on Saturday and a dozen others were wounded in bomb and gun attacks by Islamist militants, police and witnesses said.
Al Shabaab fighters, who have threatened to step up attacks during the Muslim fasting month of Ramadan, said they detonated a car bomb that killed two soldiers guarding the Somali parliament, a few hundred metres from the presidential compound.
"This is our second attack against the parliament building and we shall continue it," said Sheikh Abdiasis Abu Musab, al Shabaab's spokesman for military operations.
Police said soldiers guarding the parliament building had prevented it reaching its target.
"The suicide car bomb was targeting the parliament entrance but it was fired on from all sides as it approached the main gate," said Nur Ahmed, a colonel in the police service.
Police said two soldiers were killed and four wounded.
The al Qaeda-affiliated al Shabaab militants killed a lawmaker and his bodyguard in an attack on Thursday, accusing them of collaborating with Christians - a reference to backing Mogadishu gets from Western powers and the African Union.
A Reuters reporter saw bloodied, broken chairs that were used by the troops guarding parliament before the attack.
"A car bomb occurred near the parliament house but we are all safe," Dahir Amin Jesow, a legislator, said, referring to lawmakers inside the building.
The militants struck again a few hours later, shooting dead three traffic officers in the Waberi district of Mogadishu, abu Musab said.
The third attack of the day, which al Shabaab did not take responsibility for immediately, was a mortar launched into the Shibis district.
"We heard an explosion but we found it was a mortar shell that landed. We have counted seven injured people," local shopkeeper Abdullahi Ahmed told Reuters.
(Additional reporting by Feisal Omar and Ismail Taxta; Writing by Duncan Miriri; Editing by Ralph Boulton)