One can learn a lot about a tradition by paying attention to how it answers the question, Is it ever right to kill? What we find when we survey world religions are teachings that are at least paradoxical, and in some cases downright contradictory. Every major religious tradition regards life and especially human life as sacred in some sense, and affirms mercy and compassion as basic human obligations. But influential religious authorities have also taught that it's sometimes right to kill other human beings. Some have gone so far as to rationalize wars of annihilation against heretics and infidels.
Religion is clearly not the only catalyst of total war and other forms of indiscriminate violence. People seem to be able to invent all sorts of rationales for mass killing without feeling the need to cite the will of God. Some of the most appalling atrocities in history have been rooted not in religion per se but rather in racial or class hatred. (Think of the 20th-century victims of Hitler, Stalin, Mao and Pol Pot.) There may even be a genetic tendency in our species, like that of our chimpanzee relatives, to attack and kill others for no reason except that they aren't "one of us" (Wrangham and Peterson).
But religious violence can take on a particularly intense and ruthless character, if the objects of that violence are seen as blaspheming or insulting God, and thus as enemies of God who must be humbled or destroyed. This way of thinking continues to spark violence in countries as diverse as India, Pakistan, Sri Lanka, Nigeria, Ireland, Indonesia, and the former Yugoslavia.
I'm hopeful, though, that some ethical principles can be affirmed by all of the world's major religions to limit violence even when it can't--or shouldn't--be prohibited completely.
I'll begin my survey with Eastern faiths. One of the oldest living religions is Hinduism. The Hindu tradition reveres all of life, and affirms an ethical principle of ahimsa or avoiding injury to any sentient creature (Klostermaier). This ethic has often led Hindus to adopt vegetarianism and strict pacifism, and has been especially strong in Buddhism and Jainism, both offshoots of Hinduism. The pacifist ethic nurtured by these faiths lives today among the followers of Mahatma Gandhi and renowned Buddhist teachers like the Dalai Lama of Tibet, Thich Nhat Hanh of Vietnam, and Maha Ghosananda of Cambodia.
Buddhism stresses the need for people to constantly be aware of how hateful and greedy emotions can arise in order to avoid being controlled by them and lashing out violently against others. Buddhism seeks to undermine social divisions like the Hindu caste system, while at the same time reinforcing its virtue of compassion and the obligation of non-injury. As a result, the duty not to kill people or other sentient animals applies to all Buddhists, though as an absolute duty it has often been restricted in practice to Buddhist monks and nuns. (Harvey)
How would pacifists within these faiths respond to a concern that nonviolence might have little or no persuasive effect on a violent enemy, and could result in the destruction of one's community? Some contend that violence only seems to be effective, but usually ends up producing merely more violence. Others admit that nonviolence sometimes does not succeed in deterring or ending violence, but also claim that success is not as important as doing the right thing. (The Christian pacifist John Howard Yoder made the same point.)
Hindus and Buddhists believe in the Law of Karma, which rigorously enforces justice through an indefinite series of rebirths. So even if evil people succeed in their present lives, they'll pay for it in their next life. Trusting in the Law of Karma can help to motivate adherents of these faiths to overcome selfishness and hostility and resist succumbing to violence. (This functions similarly to the Western belief in a heavenly reward for living a devout and moral life, even if one suffers great injustice during one's earthly life at the hands of evil people.)
In practice, though, Eastern traditions often permit some exceptions to the general rule against killing. In mainstream Hinduism there is an entire caste of warriors, the Ksatrias, whose role in defending the community with force is considered to be just as important as that of the Brahmin or priestly caste. If a Hindu man is born into the warrior caste, he is obligated to kill enemy soldiers in defense of the community; his social role does not permit him to be a pacifist. He must kill with the proper disposition, though, without greed or anger. (Read the "pep talk" given by the god Krishna to the reluctant warrior Arjuna in the Bhagavadgita.) Some Hindu gods like Indra are believed to have warlike characteristics themselves, and are praised for destroying the enemies of orthodox Hindu teachings and practices. (Klostermaier)