In a memoir published last year, “To the Mountains: My Life in Jihad from Algeria to Afghanistan,” Mr. Anas sought to correct what he called many of the myths about the Arab volunteers that arose after the Sept. 11, 2001 attacks. Foremost among those, he said, was the notion that thousands of them fought in Afghanistan. By his count, there were only around a hundred committed fighters in Afghanistan at any one time.

He describes his time in Afghanistan as helping guide the volunteers in religion and moral behavior as much as military activity, and mediating between warring Afghan factions as much as fighting the war.

But he is also frank about the damage that extremists and sectarianism have done to the course of jihad — including those who perpetrated the Sept. 11 attacks and those, who remain unidentified, who assassinated his father-in-law.

“I will never denounce jihad,” he writes. “As a Muslim I know this to be a noble deed, the peak of perfection — where man can be the most beastly, he chooses to be humane.”

To Mr. Anas, as to most Muslims, jihad — literally, “struggle” — is a fundamental principle of the Muslim faith. Defending your country and other Muslims against occupation and repression, they believe, will be rewarded in heaven.

But he distinguishes that sort of jihad from what in Islam is often called “offensive jihad,” removing impediments to the spreading of Islam. Islamic jurists have argued in the past that impediments can include political powers, which can lead to armed struggle against established governments. Mr. Anas said he believes this concept has no place in the modern age.