By Zoe Flood in Nairobi and Abdiaziz Abdinuur in Mogadishu -Telegraph.
The three men were shot by firing squad in a public execution in Marka, a town in the south of the war-torn Horn of Africa nation, late on Sunday. Two of the men were accused of guiding US drones to kill fellow militants, including British passport-holder Bilal el Berjawi and other foreign fighters.
Alleged al-Qaeda official Berjawi was killed in a missile strike from a US drone on the outskirts of the capital Mogadishu in January, according to al-Shabaab.
The third man was accused of being an agent for British intelligence.
"Masked fighters from the militant group killed the three men using bullets, while hundreds of Marka residents gathered to watch the execution," a resident of Marka, who identified himself as "Abukar", told The Daily Telegraph by telephone.
"I was shocked when I heard the sound of bullets, I witnessed something very awful," added Abukar. "There were even women and children watching."
The movement's insurgency is under pressure from African Union forces – comprising Kenyan troops pushing north and a mixed force gaining ground from Mogadishu – as well as Ethiopian troops coming in from the west.
Suspected US drone strikes have also targeted Islamist extremists, particularly in the south of the country.
Sheikh Abdi Haq, an al-Shabaab judge, said he ordered the men be put to death for facilitating drone attacks that targeted senior al-Qaeda officials in Somalia.
"They helped the US carry out drone attacks that killed Bilaal Berjawi and other brothers from around the world," Haq told The Daily Telegraph. "We will kill anybody who works with the CIA and MI6."
Haq alleged that Yasin Osman Ahmed, 23, and Omar Hassan, 22, worked for the CIA in Somalia, while Mukhtar Ibrahim Sheikh Ahmed, 33, worked for British intelligence based out of Hargeisa, Somaliland.
But independent Somalia analyst Jay Bahadur questioned the motives for the executions, pointing instead to divisions within al-Shabaab.
"These executions could be part of persistent divisions between Somali nationalists within the movement and those advocating global jihad," he said.
Al-Shabaab formally joined al-Qaeda earlier this year, a move welcomed by the terror network's leader Ayman al-Zawahiri, with Somalia becoming an increasingly important front in the global war on terror.Ayman al-Zawahiri, with Somalia becoming an increasingly important front in the global war on terror.