The two accused spies died amid a fusillade of bullets from a firing squad organized by a hardline Islamist militia. The condemned pair were only girls, aged 15 and 18, and their grieving relatives say they were uneducated, usually stayed at home and could not have spied for anyone.
Horrified residents of the town of Belet Weyne, in western Somalia, were forced to watch the execution by al-Shabab on Wednesday. One woman fainted as the girls were gunned down by 10 masked executioners.
"Those who watched the event could not bear the painful experience. Two very young girls were shot as they watched and no one could help," said Dahir Casowe, a local elder.
Al-Shabab is linked to al-Qaida and has carried out whippings, amputations and executions to enforce its own strict interpretation of Islam. But this was the first public execution of girls in Belet Weyne, which al-Shabab took over just over a year ago.
Only shortly before the executions, Sheik Mohamed Ibrahim sentenced the girls to death for spying for government soldiers fighting al-Shabab. The only qualifications Ibrahim needed to be appointed a judge by al-Shabab were that he be male and know the Quran.
Abdiwali Aden, a witness, told The Associated Press by phone that al-Shabab militiamen had walked through Belet Weyne's streets, using microphones and handheld speakers to order residents to attend the pending executions.
Later, Ayan Mohamed Jama, 18, and Huriyo Ibrahim, 15, wearing veils and blindfolds, were brought before the hundreds of gathered residents. As they were mowed down with assault rifles, the girls shouted "There is no God but Allah," said a witness who asked not to be named for fear of reprisals. A woman fainted, said Da'ud Ahmed, another witness.
Ayan's father, Mohamed Jama, said she had gone missing for two days. Then a week ago relatives informed him that she was in the custody of al-Shabab. Jama said he went to try and see his daughter but was not allowed to.
"Al-Shabab officials there told me that she was captured during fighting between the militants and the government soldiers outside the town and that she would be brought before court. As I waited for good news, she was killed on Wednesday. I am shocked and cannot say more," said Jama.
Osman Ahmed, one of Huriyo's cousins, said the girls came from poor families who could not afford to send them to school so they stayed at home.
"There was no way uneducated young girls could spy for anybody," Ahmed said.
Sheik Yusuf Ali Ugas, the governor of the Hiran region who was appointed by al-Shabab, told the crowd over a loudspeaker that the girls were captured during fighting and that they admitted to spying. But Sadia Osman, who witnessed the execution, said one of the girls proclaimed her innocence.
Ugas warned residents against using their mobile phones or cameras to photograph the execution, saying they risked amputation if they did so. He indicated there may be more executions.
"We still have in our jails dozens of other people facing the same charges. They will also be brought before the Shariah court," Ugas told the crowd, according to witnesses.
A local elder, speaking on condition of anonymity because he feared reprisals, said the girls' so-called trial was a sham.
"No evidence was presented," he said. "There was no independent investigation. I think the execution was only meant to show the cruelty of al-Shabab militants so the residents in the region are terrified."
Human Rights Watch said in an April report that al-Shabab imposes "unrelenting repression and brutality."
Al-Shabab, which vows allegiance to al-Qaida and whose members include foreign fighters, controls large parts of southern Somalia and much of the capital, Mogadishu.
Somalia has not had an effective central government for 19 years. The U.N.-backed government controls only a few blocks of Mogadishu, while its allies control much of central Somalia.
Associated Press writer Mohamed Sheikh Nor contributed to this report.