Terrified victims leapt from windows as Somali special forces stormed a Mogadishu hotel where Muslim extremists from Al-Shabaab mounted a deadly attack Friday, first exploding a car bomb at the gate and then mounting a siege of the compound frequented by government officials. 

The elite soldiers poured into the Maka-Mukarramah Hotel, where as many as four members of the terrorist group were holed up and several civilians were trapped after the attack that left at least nine people dead, local police said. Sporadic gunfire could be heard inside the compound, and police said terrorists were holding off police until the special forces went in.

One bloodied government soldier was dragged out by colleagues and put in an ambulance. A witness who made it safely outside the hotel after jumping from a window said the gunmen were killing anyone they could find.  

"Al-Shabaab fighters are on the top of the building and inside the hotel."

- Police Major Ismail Olow

Al-Shabaab claimed credit for the attack, in which at least a dozen were injured and the death toll was expected to rise. An unknown number of people were trapped in the hotel, although authorities did not characterize them as hostages.

"We are behind the Hotel Maka Al Mukaram attack and fighting is still going on inside the hotel," Sheikh Abdiasis Abu Musab, Al-Shabaab's military operations spokesman, told Reuters.

Earlier, police were swarming the building.

"Al-Shabaab fighters are on the top of the building and inside the hotel," Police Major Ismail Olow told Reuters. "Some government officials are inside the hotel."

The attack came a day after an Al-Shabaab top commander and three other suspected militants were captured by Somali security forces Thursday, a Somali senior intelligence officer told African news site News24.  

Security forces raided an Al-Shabaab hideout in northern Mogadishu, seizing weapons, ammunition, and explosives.

Although the commander has not yet been identified, an investigation is underway. Authorities believe the commander masterminded several suicide attacks or assassinations in Mogadishu in recent months, an anonymous source said.

Government spokesperson Ridwan Hagi Abdiwali confirmed that the four were captured Thursday and said the government would release full information soon.

Al-Shabaab issued no comment on the arrests.  

Al-Shabaab—which believes in the strictest application of Islamic law-- has killed dozens of people in suicide attacks in Mogadishu this year. The Maka Al Mukaram Hotel has been the site of several deadly car bombings in recent years. Two weeks ago, a car bomb exploded outside the hotel, killing two people.

The Associated Press contributed to this report.