Jihad in War
The Jihad for fighting was instituted after the Muslims had migrated to Madeenah. The Muslims that had migrated from Makkah to Madeenah had been oppressed in their own homes, tortured for their beliefs, and most of them forced to flee the persecution of the Quraish of Makkah to save their lives. In doing so, they lost everything they had owned in Makkah, Their propety was looted and their houses and lands taken from them. Even as they found peace in Madeenah with other fellow Muslims, the idolators of the Quraish of Makkah still sought to pursue and attack them, for no other reason, except that they were Muslims. It was to deal with this that Allah commanded the Muslims to fight those who came to attack them. Allah (سبحانه و تعالى) revealed the verse:
And fight in the Way of Allah those who fight you, but transgress not the limits. Truly, Allah likes not the transgressors. [Quran: Surah 2 al Baqarah 2: Ayah 190]
And also: Permission to fight has been given to those who are being fought, because they were wronged. Verily, Allah is able to give them victory. They are those who have been evicted from their homes without right and only because they say: Our Lord is Allah. [Quran: Surah 22 al-Hajj 22: VAyah 39]
Allah (سبحانه و تعالى) continues and tells us the injustices the Muslims were suffering, and of his command to the Muslims to protects temples, churches, synagogues, and mosques; all places of worship:
Those who have been expelled from their homes unjustly only because they said: "Our Lord is Allah." - For had it not been that Allah checks one set of people by means of another, monasteries, churches, synagogues, and mosques, wherein the Name of Allah is mentioned much would surely have been pulled down. Verily, Allah will help those who help His (Cause). Truly, Allah is All-Strong, All-Mighty. [Quran: Surah al Hajj 22: Ayah 40]
Despite suffering persecution, at the hands of his enemies, the Prophet (صلى الله عليه و سلم) commanded the Muslims to adhere to the highest standard of conduct and he prohibited them from plundering the enemy’s wealth. On one occasion, the Prophet (صلى الله عليه و سلم) saw that some of his companions had looted the enemy’s sheep. He commanded them to return the property to their owners: Tha’labah ibn Hakam reported: "We came across some sheep of the enemy, so we plundered them and set up our cooking pots. The Prophet passed by and ordered that they be overturned. The Prophet (صلى الله عليه و سلم) said: 'Verily, plunder is unlawful.'" [Sunan Ibn Mājah 3938, Grade: Sahih]
Abdullah ibn Yazid Reported: The Prophet, peace and blessings be upon him, prohibited plundering and mutilation. [Ṣaḥīḥ al-Bukhārī 5197, Grade: Sahih]
It is narrated by Ibn 'Umar (رضي الله عنه) that a woman was found killed in one of these battles; so the Messenger of Allah (صلى الله عليه و سلم) forbade the killing of women and children. [Sahih Muslim]
Anas ibn Malik reported: The Messenger of Allah, peace and blessings be upon him, said to his army: "Go forward in the name of Allah, with Allah, and upon the religion of the Messenger of Allah. Do not kill the elderly, children, young people, or women. Do not steal from the spoils but collect them, and behave righteously and in the best manner. Verily, Allah loves those who behave in the best way." [Sunan Abī Dāwūd 2608, Grade: Hasan]
During his life, the Messenger (صلى الله عليه و سلم) gave various injunctions to his forces and adopted practices toward the conduct of war. The most important of these were summarized by his companion and first Caliph, Abu Bakr (رضي الله عنه), in the form of ten rules for the Muslim army. He instructed the Muslim army as follows:
"O people! I charge you with ten rules; learn them well!
Stop, O people, that I may give you ten rules for your guidance in the battlefield. Do not commit treachery or deviate from the right path. You must not mutilate dead bodies. Neither kill a child, nor a woman, nor an aged man. Bring no harm to the trees, nor burn them with fire, especially those which are fruitful. Slay not any of the enemy's flock, save for your food. You are likely to pass by people who have devoted their lives to monastic services; leave them alone."