A barrage of bullets and two car-bomb blasts rattled Mogadishu on Sunday when nine al-Shabab Islamist extremists stormed Somalia’s main court complex, officials said, in a two-hour attack that shows the country’s most dangerous militant group might be down but not defeated.

A preliminary death toll stood at 16, including all nine attackers. The government did not immediately publicize the number of security forces, government employees and civilians who died during the attack.

The assault was the most serious in Mogadishu since al-Shabab was forced out of the capital in August 2011. Al-Shabab controls far less territory today than in recent years, and its influence appears to be on the decline, but Sunday’s attack proved that the extremists are still capable of well-planned, audacious assaults.

The top U.N. official for Somalia, Augustine P. Mahiga, said he was shocked and outraged by the attack. Mahiga said the number of dead was not clear, but that reports indicated “many innocent civilians were killed, including women and at least one child.”

The attack on the Supreme Court complex began about 12:30 p.m., sparking running battles with police and army forces. One car bomb detonated outside the court and gunmen were seen on the roof of a court building firing shots, an Associated Press reporter at the scene said. Police officer Hassan Abdulahi said he saw five bodies at the entrance to the court.

The militants took an unknown number of hostages during the siege. Many other government workers and civilians in the court complex — a confusing labyrinth of buildings and rooms — tried to hide.

Western officials knew militants had been planning a major strike. The British Foreign Office on Friday released a travel warning for Somalia that included a high threat of terrorism. “We continue to believe that terrorists are in the final stages of planning attacks in Mogadishu,” it said.

The complex and sustained nature of the assault on the court system suggested that the extremists intended many casualties. Later, a suicide car-bomber rammed a vehicle carrying Turkish citizens, killing two.

On a Twitter feed thought to belong to the militants, al-Shabab appeared to take credit for the attack. A posting said five militants from the “Martyrdom Brigade” took part in the “daring” attack.

“Such brazen attacks, on a broad daylight and in the heart of Mogadishu, are a clear testament to the influence of HSM forces in the capital,” one posting said. HSM is an abbreviation for al-Shabab.

Prime Minister Abdi Farah Shirdon dismissed the attack as a “pointless and pathetic act” that he said would have no effect on the government’s commitment to progress.

— Associated Press

Two mothers run with their children after a suicide bomber attack on a court complex in Mogadishu left several dead. (Mohamed Abdiwahab/AFP/Getty Images)