At least five people have been confirmed dead and several more injured in an attack Sunday at a courthouse in Mogadishu, police said.
Minutes later, a remote car bomb blast elsewhere in the Somali capital left several wounded, a witness said.
"So far at least five people, among them civilians, were confirmed dead. The death toll could be higher since the situation is not under control yet," Ahmed Abdulkadir, a police officer at the courthouse, told AFP.
An unknown number of gunmen and suicide bombers suspected to be Shebab militants attacked the courthouse at around 12:30 pm (0930 GMT).
"Shebab suicide bombers have attacked the court and regional headquarters area. At least one of them detonated himself, leaving several dead," said Abdirahman Mohamed, an intelligence officer in Mogadishu. Witnesses say at least three suicide bombers are believed to have detonated themselves.
"There are still several of them fighting the security forces inside the building," Mohamed said.
Abdiweli Hussein, another police officer at the scene, said Somali forces, police and African Union troops with AMISOM were "trying to restore normalcy".
The courthouse is near the city's administrative headquarters, which are heavily guarded, according to witnesses.
Witnesses said the suicide bombers and the gunmen, who were dressed in Somali military uniforms, stormed the main court building and started shooting at the security guards who fired back.
"They entered the building and then several explosions occurred. A car exploded outside. The whole area is a mess," said Ali Moalim, a witness.
Contrary to earlier claims that court was not is session at the time of the attack, witnesses said several government officers were in the courthouse complex.
It is believed that senior judiciary officials including the judge of the Supreme Court were in the building when the gunmen stormed in. It was not known whether court officials were among the casualties.
"We are trapped inside the offices and we cannot go outside," Fadumo Ali, a witness inside the office of the regional administration next door to the courthouse, told AFP by telephone. "Some of the terrorists are still inside the court building and they are wearing explosive vests. The building has been surrounded by the Somali troops and AMISOM peacekeepers."
Nur Osman, a witness to the separate car bomb attack, told AFP: "The car was filled with explosives and was parked by the roadside."
Osman, who was on the rooftop of a nearby building, added: "They detonated it remotely when a convoy of the Turkish aid organisation was passing by."
Despite a string of losses in recent months, the Shebab remain a potent threat, still controlling rural areas as well as carrying out guerrilla attacks in areas apparently under government control.
Somalia has been ravaged by conflict since 1991, but a new UN-backed government took power last year, ending eight years of transitional rule by a corruption-riddled administration.