Somalia's al Shabaab terrorist group claimed to have killed a Somali British citizen accused of spying for MI6.

The terrorist group said it had shot five men accused of spying, including a Somali British citizen, in a southern province of the country on Tuesday.

"Five of them were publicly shot to death after they admitted espionage before the court," said Mohamed Abu Abdalla, al Shabaab's governor for the Jubba regions.

"Awale Ahmed Mohamed, 32 spied for MI6 and he came from Britain to Somalia to establish Islamic State," he said.

The group said in a separate statement that the 32-year-old Briton had admitted to spying on the Somali diaspora in Britain before being sent to Somalia.

It said three of the other men had been accused of spying for the US and had admitted to leading US special forces on a house raid and helping with drone strikes. The fifth man was accused of spying for the Somali intelligence.

The group said the men were tried on Tuesday afternoon by an al Shabaab judge before being tied to poles in an open field outside Jilib, a town in the southern Middle Jubba region, and executed by firing squad in front of hundreds of people.