Islamic insurgents set off a car bomb outside Somalia's presidential palace, then stormed the compound and killed at least four people, officials said.

President Hassan Sheik Mohamud was safe and inside his office after Friday's attack, said Somalia's Minister of Security Abdikarim Guled. But at least two senior government officials were among the dead.

Ten assailants were also killed, according to police officer Abdinur...