A police officer in Somalia says Islamic extremist gunmen shot dead a prominent lawmaker in the north of the capital, Mogadishu, late Saturday.

Capt. Mohamed Hussein said Osman Elmi Boqore, the country's oldest legislator estimated to be over 80, was shot dead by gunmen who pulled up near his car as he was being driven through Karan district.

Somalia's Islamic extremist rebels, al-Shabab, which is allied with al-Qaida, claimed responsibility for the murder of Boqore, an outspoken politician and one of the country's longest-serving members of parliament.

President Mohamed Abdullahi Mohamed and his prime minister Hassan Ali Khaire condemned the assassination, instructing security services to investigate.

Al-Shabab has previously carried out attacks against government officials, African Union peacekeepers and United Nations staff in a deadly campaign of suicide bombings and gun attacks. Militant attacks have continued despite al-Shabab being ousted from its bases in Mogadishu in 2011.