Islamist militants attacked a checkpoint in Somalia's semi-autonomous Puntland region, killing at least five people in the early hours of Monday, police said.
The fighters from the al Shabaab group then ambushed officers rushing in to help colleagues on the outskirts of the city of Bosaso, police Captain Abdifatah Mohamed said.
"At about 1 a.m., many well-armed al Shabaab fighters attacked us from all directions in an attempt to capture the checkpoint," he told Reuters.
"We repulsed them but lost five people, including three police and two civilians." At least 13 others were wounded in the clashes, he said over the phone from the checkpoint.
Al Shabaab has launched a string of attacks on Somalia's capital Mogadishu and other area controlled by the federal government in a bid to oust the Western-backed authorities and impose its interpretation of Islamic law.
Attacks are relatively rare in Puntland, which has its own government and security forces patrolling its territory on the northeastern tip of the Horn of Africa, jutting out into the Gulf of Aden and the Arabian Sea.
Puntland is also home to a splinter group of al Shabaab that has sworn allegiance to Islamic State. Security sources say a small contingent of foreign fighters is based there.