Somali rebel group al-Shabab has shot dead a legislator in the capital Mogadishu, the fifth killing of an MP in less than four months.

A spokesman for the al-Qaeda-linked group fighting the western-backed government claimed responsibility for the killing of Aden Madeer, outside a Mosque in the Hamar Weyne district shortly after Friday prayers.

"This was a legitimate target, and he was killed on the orders of Allah," Abdiaziz Abu Musab the group's military operations spokesman told AFP news agency.

Abu Musab said the rebels would kill legislators "one by one" if they continued to back President Hassan Sheikh Mohamud's government.

Witnesses said Madeer was gunned down by two men shortly after leaving Friday prayers.

"When he started his car, gunmen blocked him with another car and opened fire on him," said Abdullahi Osman, who witnessed the attack. "The gunmen then disappeared with their own car."

Legislator Dahir Amin Jesow said the killings would not deter other members of parliament. "Those MPs whose life span has ended will die but we shall continue our work," he said.

Al-Shabab gunmen killed two lawmakers in April and two more in July.

Bombings and assassinations have increased in the Somali capital in recent months, prompting fears of a return to daily violence in a city that has enjoyed a relative period of calm since al-Shabab was pushed out of the capital in 2011.

Source: Agencies