OKay, so as a government, you have a returned jihadi. You kind of want to know what he or she is up to when theyre back in your country and youre kind of that they want to kill more people.
What better way to keep an eye on them is to put them in a location of your choosing (in other words, social housing in te middle of Dundee, Scotland, so no chance of there being fellow radicals). You can bug the shit out the house and basically keep an eye on the jihadi almost all the time. That also increases the chance of getting to know his or her network.
If this isnt entirely the case and the jihadi has returned slightly cured of his ISIS zealotry, it may be a decent shot at reintregration thereby making sure attacks dont happen too.
I get that it goes against a more conservative approach of people having to be punished for what theyve done, but youre not going to stop radicalisation if you just put them in a cell. This is controversial, but pragmatic.
Dont forget these kinds of decisions arent usually made by politicians, but by the intelligence services. They kind of know what theyre doing.