(CNN) -- A car bomb exploded Thursday, killing at least 12 people near Somalia's national intelligence headquarters in the capital of Mogadishu, security spokesman Idris Aden said.
Most of them were government soldiers.
At least 10 other people were injured in the blast after a minivan packed with explosives crashed into a restaurant and blew up, sending flames and black smoke into the air.
Al-Shabaab rebels claimed responsibility for the attack, which spokesman Sheikh Abdiaziz Abu Musab said killed 15 security force members.
The injured were taken to a nearby hospital, Aden said.
The restaurant is popular with Somali security forces.
Last week, militants carried out a deadly attack on Somalia's presidential palace, exploding a bomb and then opening fire.
At least 12 died, including two government officials and seven Al-Shabaab attackers, but President Hassan Sheikh Mohamud was unharmed.
Bombings have rattled Mogadishu in regular intervals this year, and Al-Shabaab has regularly taken responsibility for them.
The group, which the United States has designated as a terrorist organization, hopes to turn Somalia into a fundamentalist Islamic state by force. It also has launched attacks in other countries, such as Kenya and Uganda, that have killed dozens.
CNN's Saad Abedine contributed to this report.