Here’s an interesting study. An Oxford researcher compared military intervention in the Middle East to the number of Islamist terrorist casualties by country. Unsurprisingly, the correlation was positive:
The sample size is small, the correlation is so-so, and this result wasn’t peer-reviewed. That said, it sure looks as if the answer to Islamist terrorist attacks is to stop invading Muslim countries.