Gunmen have killed a top Somali judge who had sentenced many pirates and human traffickers to long jail terms, the security minister for northern Somalia said Thursday.

Mohamed Said Samatar said three men were arrested Thursday over the killing of High Court Judge Mohamed Abdi Aware. In addition to jailing suspected pirates, Aware also recently jailed four members of Somalia's Islamic insurgency.

Eyewitness Mohamud Dahir said masked men with pistols shot the judge in the head and chest several times as he left a mosque Wednesday evening in the port city of Bossaso.

"These gangs hate him for his justice. We suspect one of them may have something to do with his assassination," said Aware's cousin, Abdulahi Jama.

Aware was also a member of Puntland's Supreme Judicial Council, which supervises the judiciary and nominates senior judicial officials.

Samatar says Puntland legislator Ibrahim Ilmi Warsame was also shot dead Wednesday as he sat in a restaurant with friends. It was not immediately clear if the killings were linked.

Targeted killings are rarer in Puntland than in south central Somalia, where the embattled government is fighting an Islamic insurgency. Pirate gangs have exploited the lawlessness to launch attacks from many towns along Somalia's coastline, including several in Puntland.

Somalia has not had an effective central government for 18 years, although Puntland has set up a semiautonomous government and the northern region of Somaliland has declared its independence.

Warlords overthrew longtime dictator Mohamed Siad Barre in 1991. They then turned on each other, plunging Somalia into chaos and anarchy.