A suicide bomber has killed at least 18 police officers during a parade at a training centre in the Somali capital, Mogadishu.
The bomber, disguised as a policeman, blew himself up at the General Kaahiye Police Academy.
The militant Islamist group al-Shabab has said it carried out the attack. The group regularly carries out bombings in Mogadishu and other towns.
Witnesses said the officers were crowded into an open square for their early morning parade when the bomber detonated his explosives.
Some of the police were already in lines, and others were gathering, when the man in police uniform entered and blew himself up," said Hussein Ali.
One police officer, Ibrahim Mohamed, said the toll would have been higher if the attacker had managed to get into the centre of the crowd.
Police spokesman Maj Mohamed Hussein said officers had been rehearsing for national Police Day celebrations later this month.
Al-Shabab described the attack as a "martyrdom operation" in a statement posted online.
The group, which is allied to al-Qaeda, is battling the UN-backed government in Somalia. It has been driven out of Mogadishu and most of the main towns it once controlled but remains a threat.
In October, al-Shabab fighters stormed a hotel in the capital killing at least 20 people.
However, the group denied being behind a truck bomb attack in the city earlier in October that killed at least 358 people.
A 22,000-strong African Union force (Amisom) is in Somalia trying to help the government recapture territory from militants.
But the force is due to be trimmed back as part of a long-term plan to transfer security to the Somali army.