Five civilians were killed in a gun battle between militant Islamists and security forces at a hotel in the Somali capital, Mogadishu, news agencies report quoting the police spokesperson.

Four attackers were also killed, three of them shot and another who detonated himself, according to the AFP news agency

The security forces ended the assault early Monday.

“The operation is over now. Nine people including four attackers died and over 10 civilians were injured,” Sadik Ali is quoted as saying.

President Mohamed Farmaajo said among those killed was a former military general, Mohamed Nur Galal.

“I ask God to have mercy on the Somali citizens who lost their lives in this barbaric attack, and I extend my deepest condolences on the death of General Mohamed Nur Galal, a veteran of the Somali Army,” he said

Al-Shabab said it was behind the attack at the Afrik Hotel, which began with a car bomb on Sunday afternoon.

The hotel is known to be a gathering place for Somali government officials.

The group, which is linked to al-Qaeda, regularly carries out attacks against the government.