NEW YORK: Two Swedish citizens who US prosecutors said fought alongside the militant group Al-Shabab in Somalia in battles to take control of the country’s capital of Mogadishu were sentenced to 11 years in prison on Friday.

Ali Yasin Ahmed, 31, and Mohamed Yusuf, 33, were sentenced by US District Judge John Gleeson in Brooklyn, New York, in light of their guilty pleas in May to conspiring to provide material support to Al-Shabab.

Prosecutors had sought 15 years in prison for the Somali-born men, who they called “operational members of a terrorist organization.”

But while Gleeson said that was correct, he said he also partly accepted their lawyers’ characterizations of the men as freedom fighters who only joined Al-Shabab in order to return to war-torn Somalia to fight against Ethiopia.

“This is not a black-and-white situation,” Gleeson said.

Prosecutors said Ahmed and Yusuf abandoned their homes in Sweden in 2008 to travel to Somalia to undergo military and doctrinal training with Al-Shabab.

After receiving training, Ahmed and Yusuf traveled to Mogadishu, where they fought in battles alongside other U.S. and European fighters who had joined Al-Shabab to take control of the city in 2009, prosecutors said.

Ahmed and Yusuf continued to train and fight with Al-Shabab, prosecutors said, and Yusuf appeared in a propaganda video filmed in Mogadishu urging people to fight on behalf of the militant group.

The men and a former British citizen, Madhi Hashi, were arrested in August 2012 in Djibouti after illegally crossing the border from Somalia on their way to Yemen to join Al-Qaeda in the Arabian Peninsula, prosecutors said.

Their lawyers said the men were tortured while in custody in Djibouti over the next several months before being turned over US authorities for prosecution, though their case had no allegations that they intended any direct harm to the United States.

Assistant US Attorney Shreve Ariail said the “unconscionable” treatment they received in Djibouti factored into extending plea deals that capped their prison terms at 15 years.