BOSASSO, Somalia (Reuters) - Al Shabaab Islamist militants shot dead a military prosecutor in Somalia’s semi-autonomous Puntland region on Sunday, witnesses and officials said, the type of targeted killing that Al Qaeda-allied gunmen frequently commit throughout Somalia.

Al Shabaab’s insurgency aims to drive out African Union peacekeepers, topple Somalia’s Western-backed government and impose its strict version of Islam on the Horn of Africa state.

On Sunday, Abdikarim Hassan Firdiye was shot dead as he got out of his car outside a restaurant in Puntland’s largest city, Bosasso.

Just a few days ago, a regional official’s aide was killed in a similar and targeted attack and, days before that, al Shabaab gunmen killed the region’s deputy police commander outside a hotel.

“Two teenagers armed with pistols shot him in the head after he got off his car,” Hassan Ahmed, a waiter at the restaurant, told Reuters.

“His bodyguards fired back but the killers had already disappeared by then,” he said.

Abdifatah Haji Aden, Chairman of Puntland’s military court, said: “We believe it was the same militants who killed the other two officials last week that also killed him. We shall pursue them.”

Al Shabaab claimed responsibility for the killing.

“Today, we killed a prosecutor who had sentenced many teenagers - many boys and girls - to their deaths for alleged links to al Shabaab,” said Sheikh Abdiasis Abu Musab, the group’s military operations spokesman.

The al Shabaab insurgency persists in Somalia as the country struggles to restore order and rebuild infrastructure after more than two decades of conflict and chaos that have left the nation in tatters.

Somalis have been voting for weeks for a new parliament and will vote for a new president on Dec. 28.