By Abdi Sheikh and Feisal Omar
MOGADISHU (Reuters) - Twin car bombs killed 18 people in Somalia's capital Mogadishu on Friday in an attack by the Islamist militant group al Shabaab, but security forces shot dead five assailants, officials said.
Shooting broke out near the president's residence at the time of the explosions, police and ambulance services said.
"So far we carried 18 dead people and 20 others injured from the blasts tonight," Abdikadir Abdirahman, the director of Amin Ambulances, told Reuters.
Police said the first car bomb went off after militants breached a checkpoint near the president's residence by shooting at security personnel. The second blast was a car bomb parked in front of a hotel away from the palace.
"The militants got off when they neared the palace, the suicide car bomb exploded outside the palace where there were many military soldiers who guarded the street adjacent to the palace," Major Omar Abdullahi told Reuters.
Al Shabaab, who have claimed responsibility for previous bombings and gun attacks in the capital, said they killed 15 soldiers in Friday's attack, but this could not be confirmed.
"Two operations including two car bomb martyrdoms went on around the presidential palace and a national security forces’ base called Habar Kadija," al Shabaab military spokesman Abdiasis Abu Musab said.
The group, which is linked to al Qaeda, wants to overthrow the Somali government and impose its own harsh interpretation of Islamic law. It has killed hundreds of civilians across East Africa and thousands of Somalis in a decade-long insurgency.
Security Minister Mohamed Abukar Islow said the security forces had subdued the al Shabaab attackers and killed five of them.
"The security minister confirmed the operation was concluded and that the five militants who launched the attack were shot dead," the state news agency quoted him as saying.
Al Shabaab's Abu Musab said their fighters were yet to be subdued.
The streets around the palace and the hotel were surrounded by security forces, witnesses said.
In October, more than 500 people were killed in twin bomb blasts in Mogadishu. The bomb attacks were the deadliest since al Shabaab began an insurgency in 2007. Al Shabaab did not claim responsibility for that incident.
(Reporting by Abdi Sheikh and Feisal Omar; Writing by George Obulutsa, Editing by Angus MacSwan)