Somalia's al-Shabaab Islamist militant group bombed a busy junction and a nearby restaurant in the town of Baidoa on Sunday, killing at least 30 people, police and the group said.

Al-Shabaab often carries out such suicide attacks in the capital and elsewhere in its bid to topple Somalia's Western- backed government. The group wants to impose its strict version of Islamic rule in the Horn of Africa nation.

"The restaurant and the junction were very busy," Police Major Bilow Nurr told Reuters from Baidoa, which lies about 245 kilometres northwest of Mogadishu.

Police Colonel Abdi Osman said the death toll was 30, with 40 others injured.

A hospital official said many of the bodies it received were charred beyond recognition.

A police officer said a suicide car bomb blew up at the junction while a second blast — possibly a bomb that had been planted or a suicide bomber — struck the restaurant.

"We targeted government officials and forces," al-Shabaab's military operation spokesman Sheikh Abdiasis Abu Musab told Reuters, adding there was a police station nearby.

Baidoa Somalia

A police officer said a suicide car bomb blew up at a junction in the town of Baidoa, Somalia, while a second blast - possibly a bomb that had been planted or a suicide bomber - struck a restaurant. (CBC)

Ismail Olad told Reuters the two locations were full of civilians and security forces.

"I heard a huge crash at the busy junction and as I ran, I heard another blast at a restaurant ahead of me. The whole place was covered by smoke," he said.

The blasts follows a car bomb attack in Mogadishu near a park and hotel on Friday that killed 14 people, police said. He said three of the attackers from the al-Shabaab group were also killed.