Two of the men were accused of having attached a satellite tracker device to a car used by al-Qaeda operatives in January, which was later struck by a missile, killing two.
"The three defendants were found guilty of spying … one of them worked for the British intelligence agency MI6 and the two others were spying for the CIA," said Sheikh Abdalla Al-Haq, the Shebab's chief judge.
The three men, aged between 25 and 30 according to witnesses, were shot by firing squad in a public execution in the port town of Merka late on Sunday.
"All of them confessed to the charges against them, and the punishment is death," Al-Haq said.
"One of them was shouting when they dropped him off and after the judge read the verdict, they were blindfolded and shot," said Abidaziz Moalim, a witness.
"Al-Shebab officials used loud speakers on pickup trucks to call people to gather for the execution, hundreds of people came to watch," said Idris Nure, another witness. – Sapa-AFP