Like other holy books, including the Bible, there are a number of verses about warfare in the Qur’an; they address the struggle of the early Muslims against the Meccans who fought and persecuted them first in Mecca and then after they established a state in Medina, where Muslims fought back for the first time. However, they make up a small percentage of the 6,000 verses of the Qur’an. In addition, it is important to keep in mind the following:
A reading of the “warlike” verses in their context in the Qur’an invariably shows that they refer to situations in which the Muslim community was under attack, either through direct military aggression or forcible denial of legitimate rights of freedom of religion and expression—that is, they refer to, and permit, only strictly defensive warfare. Aggression is clearly prohibited (Qur’an, 2:190).
The earliest verse related to fighting (22:39) states that “permission [to fight back] is given to those who have been wronged,” clearly indicating that such permission is an exceptional allowance responding to a specific situation, and that peaceful conduct is assumed to be the norm for Muslims.
There are strict rules of warfare outlined by the Prophet Muhammad and his successors that prohibit targeting civilians, specifically women and children, or even harming infrastructure or crops used by civilians.