* Attack exposes fragile nature of security gains
* Militants waging guerrilla-style insurgency
* Somali government still dependent on African forces
Somali militants linked to al Qaeda warned on Monday of further attacks in the capital, a day after killing at least 30 people in a wave of coordinated bombings and shootings that exposed the fragility of security gains in Mogadishu.
African peacekeeping troops blocked streets and searched houses across the city at dawn to flush out suspected members of the Islamist militant group al Shabaab, which claimed responsibility for the strikes.
But the rebels warned of more attacks and taunted the Mogadishu government, which they consider a Western stooge, over its trouble securing the city as Somalia struggles to emerge from more than two decades of conflict and anarchy.
Although a military offensive under an African Union peacekeeping banner has pushed al Shabaab from urban strongholds in central and southern Somalia, the attacks reinforced concerns the militants remain a potent force.
"Yesterday's blasts eliminated the dreams of the puppet government. More lethal attacks are coming," Sheikh Abdiasis Abu Musab, al Shabaab's spokesman for military operations, told Reuters by telephone.
At least one car bomb exploded and several suicide bombers blew themselves up at Mogadishu's law courts on Sunday. Gunmen also stormed the court compound, spraying it with bullets. Two hours later, a car bomb was detonated near the city's fortified airport.
The U.N. Security Council condemned the attacks and said it was willing to "take action against those whose behaviour threatens the peace, stability, or security of Somalia."
Prime Minister Abdi Farah Shirdon said the attack would not stop the government's efforts to restore peace and security.
He said there were several experienced foreign fighters among the attackers at the courts, showing that the fight against the militants was not just a Somali affair.
"We are concerned about the foreign involvement in this attack and this is why we are working so hard with our international partners on security and intelligence sharing," he said in a statement.
Al Shabaab said six of its fighters were killed in the attack, but the government has not said how many militants died.
The law courts were a symbolic target. Somalia's new government has made reforming the judiciary a priority in its campaign to shake off the country's "failed state" tag.
The scale of Sunday's attacks suggest the Islamist militants remain well organised, enabling them to infiltrate the city from which they were driven out two years ago and target important installations with apparent ease.
Western and Somali officials are concerned the militants were seeking to rebuild their strength in the capital.
"It will be almost impossible to eliminate al Shabaab," member of parliament Mohamed Farah Jimale told Reuters. "They will regroup and continue bombing."
Britain, which has a large Somali population and has warned of threats to its own security from Somalia-trained militants, had warned this month of an imminent attack in Mogadishu, highlighting the international networks involved.
Somalia's finance minister said the attack reinforced the government's call for more aid to pay and train its security personnel as it seeks to rebuild the nation of 10 million people.
"It proves that we need the support of friendly countries to help us in improving the security forces' capability in Mogadishu and other areas," Mohamud Hassan Suleiman told Reuters.
A more stable Somalia could help curb piracy, which has flourished in the absence of an effective central government, and would soothe worries that Somali Islamists could expand territory they control which could be used as a training ground for militants who could strike elsewhere.