Well one way of handing it might be to stop letting those convicted of terrorist offences out after no time at all so that they can go all Mr Stabby.
Given that we invariably end up claiming they're mentally ill, could we not simply stick 'em in Broadmoor indefinitely rather than letting them infect our prison systems?