Al-Shabaab Islamist militants, who threatened to step up attacks during the Muslim month of Ramadan, said they were behind a blast in Mogadishu that killed two people in the Somali capital's political centre.
A car bomb exploded near the Somali parliament building, a few hundred metres from the presidential compound.
"This is our second attack against the parliament building and we shall continue it," said al-Shabaab's spokesman for military operations.
Police said soldiers guarding the parliament building had prevented it from reaching its target.
Two soldiers were killed and four wounded.
Last month al-Shabaab militants set off a car bomb at the gates of parliament and then stormed the building while MPs were meeting, in an attack that left several dead.
At the time an al-Shabaab spokesman described the parliament as a "military zone" and a legitimate target.
On Thursday, the group claimed responsibility for shooting dead a politician and his bodyguard.