A suicide bomber driving an explosive-laden vehicle blew himself up at a security checkpoint to the national assembly headquarters, according to Somali officials.
Deaths and injuries were confirmed, although police have not announced the exact number of casualties.
Although there was no immediate claim of responsibility, the militant group al Shabaab frequently carries out bomb attacks in its war on Somalia's government.
Harakat al-Shabaab al-Mujahideen (Movement of Striving Youth), more commonly known as al-Shabaab, is an Islamic group based in East Africa.
In 2012, it pledged allegiance to the organization Al-Qaeda.
Al-Shabaab's troop strength was estimated at 7,000 to 9,000 militants in 2014.
As of 2015, the group has retreated from the major cities; however, al-Shabaab still controls large parts of the rural areas.