Al Shabaab Islamist militants, who threatened to step up attacks during the Muslim fasting month of Ramadan, said they were behind a blast on Saturday that killed two people in the Somali capital's political centre, Reuters reported.
The two people were killed when a car bomb exploded near the Somali parliament building on Saturday, 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 from 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 another attack on Thursday, accusing them of collaborating with Christians - a reference to the backing the government in Mogadishu gets from Western powers and the African Union.
A Reuters reporter saw bloody, 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.