Terrorists: The Justice System's Dilemma

In Europe and Tunisia, a young democracy that provided Isis with the biggest part of foreign fighters, the problem of the return of ex-jihadists is a real issue. How to judge them?