British man Darren Anthony Byrnes was one of two foreigners to be sentenced to 15 years by a military court in Somalia for belonging to Islamist militant group al-Shabab.
Byrnes and Malaysian Ahmad Mustakim bin Abdul Hamid were convicted of recruiting foreigners.
Al-Shabab has been battling Somalia’s UN-backed government for over a decade.
The al-Qaeda-linked group has also carried out attacks in neighbouring Kenya.
The two men denied being members of al-Shabab and the prosecution did not call any witnesses in court but relied on written accounts, their lawyer told Voice of America.
They have 30 days to appeal.
Byrnes came to Somalia “to shed blood”, prosecutor Brig Gen Abdullahi Bule Kamay said in a video extract of the court proceedings released by the military.
“If he is spreading Islam, why did he not do that in the UK?” he added.
The prosecution said that Byrnes had converted to Islam in 2006. He then travelled to Mombasa, on Kenya’s coast, where he married a Somali woman.
He crossed into Somalia in 2010, according to the prosecution.
Byrnes told the court in the capital, Mogadishu, that when he entered the country he came across some Kenyan soldiers, who were part of an African Union force supporting the government.
“They asked me where I am going. I said: ‘I am going to Mogadishu to visit my family.'”
“They took $50 (£36) from me, I presumed that was my visa. End of story.”
Along with Abdul Hamid, Byrnes was accused of using the internet to encourage other foreigners to join al-Shabab.
The prosecution alleged that they had tried to recruit cells to carry out an attack in Paris, France, but gave no further details on when or how.
The two men were captured in 2019 while trying to board a boat to Yemen.
In a brief statement, the British embassy in Mogadishu said it was “providing consular assistance” to Byrnes “and are offering support to his family”.
It would not comment on what happened in court.
Al-Shabab emerged about 15 years ago to support the Union of Islamic Courts, which controlled Mogadishu in 2006.
It was then forced out of the capital and has waged an insurgency ever since.
Al-Shabab carries out frequent bombing attacks in urban areas, often targeting hotels and restaurants, as well as government buildings.