Going by media reports, you'd be forgiven for thinking that terrorism was something inflicted on Westerners by middle-eastern Muslims. It's not. By far the largest group of victims are those same middle-eastern Muslims, and Pakistan is currently bearing the brunt of the violence.
The causes of terrorist violence in Pakistan are complex - conflict between locals and immigrants from India after partition (the Mohajir), friction between the centre and the periphery, and of course, being a border state in the 'Great Game' of Western vs Russian power politics. Although I don't pretend to understand it in any detail, religion is clearly caught up in it all - although not in any straightforward way.
One possible connection may be that religion is encouraged when people feel threatened. You can see this clearly in some new research from a team at the Aga Khan University in Karachi, Pakistan.
They interviewed 291 students from 4 different universities in Karachi. Almost all (90%) had been exposed to terrorist violence on the television or in conversation with their parents. A staggering 46% knew someone who had been injured or killed in a terrorist attack, and 26% had actually been personally exposed to such an attack.
When asked what strategies they used to cope with the stress, the most popular answer was that they increased their faith in religion (the table shows average scores on a 0-4 scale).
Given that so much of the violence has religious overtones, such a response may seem paradoxical. On the other hand, it may help to explain why such violence perpetuates.
Ahmed AE, Masood K, Dean SV, Shakir T, Kardar AA, Barlass U, Imam SH, Mohmand MG, Ibrahim H, Khan IS, Akram U, & Hasnain F (2011). The constant threat of terrorism: stress levels and coping strategies amongst university students of Karachi. JPMA. The Journal of the Pakistan Medical Association, 61 (4), 410-4 PMID: 21465991