Updated

Journalists and activists in Morocco during the heady days of the Arab Spring knew Anas Haloui, a slight, serious, wispy-bearded man in his 30s who would bombard them with emails about the plight of jailed Islamists.

Unlike many Salafis, as followers of his ultraconservative strand of Islam are known, he was eager to engage with people who didn't share his beliefs.

"He was a very nice guy, someone who was really open and trying to reach out to other people," recalled Brahim Ansari, Human Rights Watch's Morocco representative.

But one day in December 2013, Haloui left behind his wife and children and quit Morocco to join a group linked to the Islamic State.

"I love my country with my last breath, but I was a victim of injustice, they put me in their cells and I don't need to remind you about the torture I went through," he said in a letter of farewell in which he condemned his treatment by the Moroccan government.

His older brother, Yusuf, remembers a different Anas — one who enjoyed singing. He recalls a cheerful boy in a family of eight kids growing up in the town of Tissa, just north of Fez in the foothills of the Rif mountains.

Anas majored in Islamic studies at Fez University in 1999, at a time of great intellectual ferment when Moroccan student life was dominated by Islamist groups. His brother says he never joined but took part in their activities, writing poetry for one group.

Everything changed after the 2003 Casablanca suicide bombings by young Islamic radicals that claimed 45 lives. Some 2,300 people were arrested, and Haloui was repeatedly questioned. He dropped out of school and returned home.

His efforts to distance himself from his student activism were in vain. He was arrested and convicted of forming an extremist group and spent three years in prison, during which he told his brother he was tortured by police and interrogated by American investigators.

In prison, he grew out his hair and beard and began wearing the traditional clothes associated with the Salafis, his brother said. When he got out in 2007, he was a changed man.

"He stopped singing after prison," said Yusuf. "It was like he was imprisoned by this Salafi idea."

But the 2011 Arab Spring demonstrations in the region inspired him. In Morocco, the February 20 Movement took to the streets to demand an end to corruption and abuse of power. Haloui joined the protests with secular activists. With other Salafis, who normally avoid all forms of activism or politics, he started an organization dedicated to freeing Islamist prisoners who he believed were being held unfairly.

Morocco got a new constitution promising greater freedoms. But the police soon returned to their old habits. One day men in plainclothes picked up Haloui's fiancee, slapped her around and warned her against marrying him.

"After this his personality changed," said his brother. "His dreams were shattered."

Haloui's attention turned to the bloodshed in Syria, and the daily stories of civilians killed by the regime of President Bashar al-Assad.

"We know it is a war of extermination and that the only way to stop them from harming the innocents is through arms, God may one day ask us where we were during the Syrian events," he said in his goodbye letter, in which he expressed anguish over leaving behind his new wife and children.

From Syria, Haloui wrote that he was helping doctors treat the wounded. Four months later, in April 2013, his family learned through Facebook that he had died on a Syrian battlefield.