CASABLANCA—A decade ago, the U.S. released three hardened Moroccan militants from Guantanamo and turned them over to the Moroccan government on the assumption they wouldn't return to the battlefield.
They wound up leading one of the most violent Islamist groups fighting in Syria's civil war.
Their story serves as a cautionary tale days after President Barack Obama released five high-level Taliban figures from the same detention center in a swap for an American soldier held in Afghanistan for nearly five years.
By January 2014, about 29% of 614 detainees released from the prison at Guantanamo Bay, Cuba had returned to violence, according to the Director of National Intelligence.
Like the three Moroccans, the five Afghans went free with a friendly government's consent to monitor them. As part of the deal that released U.S. Army Sgt. Bowe Bergdahl, the Qatari government agreed to keep the five ex-detainees in the Gulf emirate for at least a year to prevent them from returning to violence.
The Moroccans, who once trained at the same Afghan camp where the Sept. 11 hijackers trained, set up their radical militant group in Syria in August 2013. Like other al Qaeda sympathizers, they saw their battle as a jihad, or holy war, to replace the Syrian state with an Islamic emirate ruled by their strict interpretation of religious law.
Their group, Harakat Sham al Islam, was at the forefront of the first significant massacre of religious minorities in August 2013 in Latakia province, which Human Rights Watch deemed a "crime against humanity."
Along with other al Qaeda-linked groups, Harakat Sham helped turn what began in 2011 as a largely secular and peaceful uprising against autocratic President Bashar al-Assad into a sectarian war.
For Ibrahim bin Shakran, Ahmed Mizouz and Mohammed Alami, their years in U.S. detention were a badge of honor. Other Islamist extremists said they admired them as symbols of a time when al Qaeda was at its strongest in Afghanistan and the struggle to restore that power in Syria today.
Mr. Mizouz is still fighting with Harakat Sham. But the group said Mr. Alami died in August 2013 and on April 1, it announced that Mr. Shakran too had died, both killed fighting Syrian forces in Latakia. The province is a stronghold of Mr. Assad's minority Alawite sect, which dominates the regime. Groups such as Harakat Sham, made up of hard-line Sunni Muslim jihadists, consider Alawites heretics.
Mr. Shakran's death brought an outpouring of grief by militants on the Internet, unusual for a leader of such a small group of only about 500 fighters.
"It's like if a famous singer dies," said a member of Harakat Sham interviewed in Antakya, Turkey. "They were in Afghanistan. They were in Guantanamo, defying America."
Mr. Shakran died shortly after Harakat Sham overran the Christian town of Kassab in Latakia in March, fighting alongside other al Qaeda groups.
As the militants approached Kassab, its residents fled. The fighting there is ongoing and residents haven't returned since fleeing in March.
"We consider ourselves lucky, " said Vartan, from Kassab, who asked to be identified by one name. "We got out before they arrived, unlike other villages."
In August, the same militant groups had overrun Alawite towns just an hour's drive away from Kassab, killing some 200 unarmed civilians and desecrating their religious shrines, according to Human Rights Watch.
Harakat Sham's profile rose during the August offensive, partly because one of its three founders, Mr. Alami, was killed in the fighting. Ayman Jawad al Tamimi, a researcher who tracks the conflict, said it was a rarity to find former Guantanamo detainees on Syria's battlefields.
Messrs. Shakran, Alami and Mizouz cut their teeth in Afghanistan, arriving from Casablanca in the year before the Sept. 11 attacks on the U.S.
Messrs. Shakran and Alami trained on weapons and explosives at al Farouq camp in Kandahar, one of the camps where the Sept. 11 hijackers trained, according to Pentagon assessments of the former inmates made public by WikiLeaks.
In the months after the 2001 U.S.-led invasion of Afghanistan, all three were detained by the Pakistani army as they fled Afghanistan across the border.
They landed in U.S. detention at Guantanamo and were labeled "enemy combatants." Messrs. Shakran and Alami were considered high risk and likely to pose a threat to the U.S., according to Pentagon assessments.
One U.S. review of Mr. Shakran in 2003 described his mentality: "He believes that in God's eyes, every mujahedeen [religious warrior] is at the highest level, just below the prophets and the disciples."
Messrs. Shakran and Mizouz were repatriated back to Morocco after the administration of George W. Bush freed them in 2004, and they were released shortly after their return, no longer deemed threats. Mr. Alami followed them in 2006, according to their Guantanamo files.
The U.S. government rarely comments on the release of detainees from Guantanamo beyond saying where they have been transferred to.
Lt. Col. Todd Breasseale, a spokesman for the Guantanamo detention center, called Morocco "a steadfast ally on the global war against terrorism," but declined to discuss any bilateral agreements. Repatriated Guantanamo detainees who return to the battlefield are "legally re-engaged," he said, meaning the former detainees can be the target of capture or kill operations by the U.S. or its partners.
Morocco's Information Minister, Mustapha Khalfi, said his government monitors suspected extremists and defended Rabat's track record. However, he said he couldn't discuss specific cases of Guantanamo returnees.
After their return to Casablanca, the three ex-detainees tried to reintegrate into society, but struggled, according to interviews with half a dozen of the men's friends and acquaintances in Morocco. Intelligence services trailed them and employers wouldn't hire them, according to these friends, who said they expected the former detainees to return to violence.
Unable to find a job, Mr. Mizouz resorted to buying cheap goods from northern Morocco and selling them on the streets of Casablanca. But every time he unraveled his bundles of wares, police would confiscate his merchandise, while other vendors went unpunished, said Abderrahim Mouhtad, from the Ennassir Association which helps former inmates reintegrate.
"They came to find help and didn't. They found nothing—that was the problem. And they kept their same anger," Mr. Mouhtad said.
In 2007, Messrs. Mizouz and Shakran were charged in Moroccan courts with recruiting for al Qaeda, according to the Pentagon. Mr. Shakran was sentenced to 10 years in prison, and was released in 2011 after serving four years. Mr. Mizouz was sentenced to two years.
In prison, other inmates looked up to Mr. Shakran and would stay up late at night as he captivated them with stories of his days fighting in Afghanistan for Osama bin Laden and his detention by the U.S.
"Shakran believed bin Laden was the savior of humanity and had a deep admiration for him," said Rida Benotmane, who was imprisoned with Messrs. Shakran and Alami in Morocco. He said he last saw Mr. Shakran in 2011 in Sale prison outside the Moroccan capital Rabat.
"He had deep convictions, and when he told us about his dreams, it was always about the triumph of Islam and to restore the glory of the past."
When Mr. Shakran was released in 2011, the Arab Spring protests had reached Morocco. He joined Messrs. Alami and Mizouz in peaceful protests demanding reform, according to friends, a sign they might be parting from their militant ways.
Even though Messrs. Shakran and Mizouz held on to their hard-line beliefs in prison, they saw a chance that the peaceful movement brewing in Morocco could be a path to their dream of a state ruled by Islamic law.
But the uprisings across the region largely failed to offer solutions to the Mideast's vast social and economic problems and sowed even deeper chaos in countries such as Syria and Libya. That only added to disillusionment with the protests.
Morocco's King Mohammed VI announced limited constitutional reforms in March 2011, before cracking down on protests. As the country's protest movement fizzled, the three men began talking about returning to violence, according to friends and fellow activists.
In Syria, the largely peaceful protests that began in 2011 had morphed into a civil war. Syria offered an opportunity to establish a foothold for the hoped-for Islamic state, something the three Moroccans couldn't do at home or in other tightly controlled Middle East countries.
"They wanted to protest and voice their demands. But they saw it led to nowhere," said Mohammed Hakiki, the executive director of AlKarama's Morocco branch, a human rights network, who participated in early Arab Spring protests with the three men.
"When they saw the state wouldn't compromise and the protests weren't working, they knew they had one place to go—Syria."