A suicide bomber disguised as a policeman blew himself up inside a police training camp in Somalia's capital Mogadishu on Thursday and killed at least 18 officers, officials said.
Police spokesman Major Mohamed Hussein said the attacker strapped explosives to his body and infiltrated the General Kahiye Police Training Academy during an early morning parade.
"Police were preparing for the 74th anniversary of police day. As they wanted to start exercise, a suicide bomber came in and blew up himself. We lost 18 police officers and 15 others were injured," Muktar Hussein Afrah, Somalia's deputy police commander, told reporters at the blast scene.
"Police will always continue their work despite death."
Witnesses who attempted to visit the site of the blast said police had sealed it off. Hours later when they were allowed in, a witness saw body parts suspected to be from the bomber on the ground in the field where police officers had been training.
The witness said the ground nearby had also been washed to remove blood stains and people were burying bodies at the police academy.
The militant Islamist group al Shabaab claimed responsibility for the attack and gave a higher death toll.
"We killed 27 police (officers) and injured more," Abdiasis Abu Musab, the group's military operations spokesman, told Reuters. Al Shabaab carries out frequent bombings in Mogadishu and other towns.
The group, which is allied to al Qaeda, is waging an insurgency against the UN-backed government and its African Union allies in a bid to topple the weak administration and impose its own strict interpretation of Islam.
The militants were driven out of Mogadishu in 2011 and have since been steadily losing territory to the combined forces of African Union peacekeepers and Somali security forces.
On Tuesday, the US Africom said the US military had conducted an air strike on a vehicle they said was strapped with explosives some 65km southwest of Mogadishu.
Thursday's attack comes at a time when the African Union is finalising plans to trim its peacekeeping mission called AMISOM.
The 22,000-strong AU force is scheduled to leave by 2020 and some security experts say al Shabaab could find it easier to stage attacks as the peacekeeping forces are reduced because government forces will find it hard to replicate their work.