This week, NPR aired a profile of "Kevin," a New Jersey man who went to jail for consuming online child pornography. When you hear the description of the material Kevin downloaded, it's hard not to be disgusted. And yet, against all odds, Kevin emerges as a somewhat sympathetic figure.

Kevin has epilepsy, and to treat it, surgeons had removed parts of his brain that affect self-control — a procedure that led to a condition called Klüver-Bucy Syndrome. The judge in his case showed lenience after Kevin's longtime doctor, a neuroscientist, testified that every single person in the courtroom would be at risk of committing similar crimes if they'd experienced similar surgery. Such cases force us to deal with a profound question at the heart of criminal law: when are human beings morally responsible for their actions?

Omar's upbringing

No one is alleging that Omar Khadr — who is now reportedly set to receive a settlement of more than $10 million from the Canadian government — had part of his brain surgically removed before he killed U.S. Army Sergeant Christopher Speer in Afghanistan. But the story of Khadr's life leading up to that deadly July 27, 2002, encounter gets us to the same moral terrain.

Omar's father, Ahmed Said Khadr, was a terrorist commander who raised his child to follow in his footsteps. Canadian-born Omar was enlisted as an al-Qaeda errand boy when he was still a tween. And the terrorist group's website praised the father for "tossing his little child in the furnace of the battle." Whether brain tissue is cut out with a scalpel or moulded by a sociopathic parent, the destruction of moral agency is the same. No one reading this can say, with certainty, that his or her life would have turned out different from Omar Khadr's if he or she was raised as he was.

Canadian-born Omar was enlisted as an al-Qaeda errand boy when he was still a tween. (U.S. Department of Defence/Associated Press)

The idea that children aren't always responsible for their actions is encoded in criminal law. And modern brain-study research shows that brain development (particularly in regard to the prefrontal cortex, which shows us the consequences of our impulses) isn't complete until we're well into our 20s.

I thought of Omar Khadr's case last month, when I read Sarah A. Topol's unforgettable New York Times magazine feature on four Nigerian boys abducted from a small fishing village, and forced into service with the Islamist terrorist group Boko Haram.

One of the abductees, Mustapha, was the same age as Khadr—15—at the time turbaned men threw him into the back of a truck and drove off into the hinterland. Under Boko Haram's tutelage, Mustapha became a drugged-up killing machine, even rising to the level of local commander. He lost count of how many men, women and children he'd slaughtered. His victims were mostly helpless villagers, old men, even babies. The tales are medieval.

Dennis Edney gives his opinion on how a U.S. court decision could affect Khadr 4:07

Yet by the time you've read to the end of Topol's article — and learn that, three years later, Mustapha has escaped Boko Haram and become a workaday taxi driver — there is nothing in you that rebels against his reintegration into civilian life.

I read Mustapha to be a traumatized child soldier seeking to please the overlords who controlled his fate. Life is cheap for Boko Haram, and Mustapha had seen first-hand what happened to his childhood friends who'd attempted to resist abduction or indoctrination. Even though his actions were monstrous, the true monster is Boko Haram, not the brainwashed boys that Boko Haram conscripted.

I feel the same way about Omar Khadr and al-Qaeda, which is why I support the government's settlement offer and apology to Khadr, ostensibly for its role in his imprisonment and mistreatment at Guantanamo Bay.

The lingering image of Khadr as a lone child among adults at Gitmo remains unsettling to me. As Human Rights Watch notes: "No existing international tribunal has ever tried a child offender for war crimes."

Also unsettling is the almost unhinged zeal with which some anti-terror hawks in this country cheered on his continued imprisonment, and insisted that any demand for lenience was akin to terrorist propaganda.

One popular pundit even wrote a book-length attack on Khadr, describing him as "every bit as demented as Paul Bernardo," "the James Bond of Jihad," "the prince of al-Qaeda" and "the biggest, smartest, most deadly fish in a pond teeming with the most vicious, depraved men on Earth." (He also predicted that a freed Khadr might feel empowered to spend his time "loitering outside synagogues and Hebrew schools." To my knowledge, this is not how Khadr— who has publicly forsworn jihad and radical Islam — occupies his days.)

Khadr deserves his apology, and his money — even if it won't buy him back his lost Gitmo years. (Nathan Denette/Canadian Press)

This is the language of right-wing social panic. We heard a lot of it in the months and years after Sept. 11 attacks, until Western societies eventually learned to do a better job balancing security versus civil rights, fear versus compassion. But in the peculiar case of Khadr, this social panic was singularly stubborn: when Khadr finally was released from prison in 2015, Prime Minister Stephen Harper still refused to admit that he'd gone overboard in his effort to keep the former child soldier locked up.

The question of when a human being — especially a child — is morally culpable for his or her actions is complex and wrenching. Even the judge in the child-porn case described at the top of this article admitted that she was conflicted.

Finding the correct balance becomes impossible in a climate of hysteria and paranoia. Khadr deserves his apology, and his money — even if it won't buy him back his lost Gitmo years. If the outlay helps us remember not to lose our moral compass the next time a child soldier comes up for judgment, it will pay dividends for years to come.

This column is part of CBC's Opinion section. For more information about this section, please read this editor's blog and our FAQ.