Several top officials of the al-Qaeda-linked group have either defected or have been killed in recent months
Somalia's militant Islamist group al-Shabab has killed by firing squad four men accused of spying for the CIA and other intelligence agencies.
The men, who included two government soldiers, were shot in front of a large crowd in the southern town of Bardhere, witnesses said.
A court run by al-Shabab had earlier convicted them of spying for the CIA, Ethiopia and the Somali government.
US air strikes have killed two senior al-Shabab commanders in recent months.
"One of the spies worked with the CIA and facilitated the killing of an al-Shabab commander," a judge in the al-Shabab-run court said.
He did not name the commander, but al-Shabab leader Ahmed Abdi Godane was killed in a US air strike in September and last month its intelligence chief, Tahlil Abdishakur, was assassinated in a similar strike in southern Somalia.
Somalia's army has been fighting the militants with help from African Union troops
Abdishakur's killing came just days after his predecessor, Zakariya Ahmed Ismail Hersi, gave himself up to the Somali government.
Bardhere resident Ali Ronow told the AFP news agency that hundreds of people watched the killing of the four suspected spies on Tuesday.
"The men were blindfolded and shot from the back by a team of hooded gunmen," he is quoted as saying.
Al-Shabab, which is linked to al-Qaeda, is notorious for killing by firing squad suspected spies.
In 2011, Muslim cleric Ahmed Ali Hussein was chained and shot dead after being accused of being a CIA spy and belonging to a sect opposed to the group.
Al-Shabab is fighting to create an Islamic state, but has lost key towns and cities in recent years to African Union (AU) and Somali government forces.
The AU has about 22,000 troops fighting al-Shabab in Somalia.
Neighbouring Ethiopia, which sees the Islamists as a major threat to its security, also has troops in the country. Some of them are part of the AU force while others operate independently.
Various armed groups have been battling for control of Somalia since the overthrow of President Siad Barre in 1991.