How did the Romans stop terrorism?
Put pressure on the family and friends and community around the terrorists to stop it. How do you do that? Execute 10 or a 100 people in that community for every one that they killed in the Roman community.
This forces the leaders and the family and the friends to monitor and police their own people.