* Suicide bomber misses army chief
* Mogadishu has been rocked by bombings this week (Adds second bombing)
By Mohamed Ahmed
MOGADISHU, Nov 30 (Reuters) - A suicide bomber attacked a military compound in the Somali capital on Wednesday, killing four soldiers and narrowly missing the army chief, hours before a roadside bomb in another part of the city left four dead.
A wave of roadside bombings have hit Mogadishu this week, killing at least seven people, in incidents that police and residents have blamed on al Qaeda-affiliated al Shabaab militants, who are seeking to topple the government.
Government forces have struggled to secure Mogadishu against attacks by the rebels who withdrew from most of their bases in the capital in August but vowed to launch large-scale attacks against government targets.
"I am alive. It was a suicide bomber. You can see his body parts. Four of our soldiers died and 12 were wounded," General Abdikarim Yusuf Dhagabadan told reporters at the site of the attack, Villa Baidoa.
The compound is sometimes used by President Sheikh Sharif Ahmed.
"The suicide bomber took advantage when guards were changing shifts at the main gate," the army chief said.
In the Dharkenley district of Mogadishu, a roadside bomb apparently targeting women street sweepers, killed four people and wounded 39, police officer Mohamed Qasim told Reuters.
Ali Muse, coordinator of the ambulance service in Mogadishu, told Reuters he expected the death toll to rise.
"Our service has collected 13 wounded people. The death toll may increase because there are a lot more casualties than we thought," he said.
A hand grenade lobbed at government soldiers wounded two people near Mogadishu port and another roadside bomb exploded prematurely in the Hamarjejab district.
The Somali government condemned the wave of attacks.
"After having been defeated in the battle field and after realising never to have had any support or confidence from the Somali people, they are engaged in a campaign of terrorising the civilian population," Information Minister Abdulkadir Hussein Mohamed said in a statement.
Since pulling out from most of their bases in August, al Shabaab have carried out large-scale suicide bomb attacks that have killed dozens of people in the capital.
The Islamist militants who want to impose a harsh interpretation of sharia law across the anarchic Horn of Africa nation, are battling Somali government troops, along with Kenyan and Ethiopian forces, in the rebel-controlled southern and central parts of the country. (Additional reporting by Omar Faruq in Mogadishu and Sahra Abdi in Nairobi; Writing by Yara Bayoumy; Editing by Diana Abdallah)