When we have vote bank politics, caste politics or politics based on ethnic or religious lines and politicians, with the motivation of winning votes by playing on community against the other, such violence will keep happening.
There is such violence in India as well. Fortunately, guns are not that freely available in India, though political hoodlums manage to get their hands on some. In Pakistan;s case, given that there is strong nationalist and tribal affiliations and a free availability of firearms, it could easily spiral out into a larger violence.