The Command to fight Those Who fight Muslims and killing Them wherever They are found
Allah command's;
وَقَاتِلُواْ فِي سَبِيلِ اللّهِ الَّذِينَ يُقَاتِلُونَكُمْ وَلَا تَعْتَدُواْ إِنَّ اللّهَ لَا يُحِبِّ الْمُعْتَدِينَ
And fight in the way of Allah those who fight you, but transgress not the limits. Truly, Allah likes not the transgressors.
Abu Jafar Ar-Razi said that Ar-Rabi bin Anas said that Abu Al-Aliyah commented on what Allah said;
وَقَاتِلُواْ فِي سَبِيلِ اللّهِ الَّذِينَ يُقَاتِلُونَكُمْ
(And fight in the way of Allah those who fight you),
"This was the first Ayah about fighting that was revealed in Al-Madinah. Ever since it was revealed, Allah's Messenger used to fight only those who fought him and avoid non-combatants. Later, Surah Bara'h was revealed."
Abdur-Rahman bin Zayd bin Aslam said similarly, then he said that;
this was later abrogated by the Ayah;
فَاقْتُلُواْ الْمُشْرِكِينَ حَيْثُ وَجَدتُّمُوهُمْ
(then kill them wherever you find them), (9;5).
However, this statement is not plausible, because Allah's statement;
الَّذِينَ يُقَاتِلُونَكُمْ
(...those who fight you) applies only to fighting the enemies who are engaged in fighting Islam and its people. So the Ayah means,
`Fight those who fight you', just as Allah said in another Ayah;
وَقَاتِلُواْ الْمُشْرِكِينَ كَأفَّةً كَمَا يُقَاتِلُونَكُمْ كَأفَّةً
(...and fight against the Mushrikin collectively as they fight against you collectively), (9;36).
This is why Allah said later in the Ayah;
وَاقْتُلُوهُمْ حَيْثُ ثَقِفْتُمُوهُمْ وَأَخْرِجُوهُم مِّنْ حَيْثُ أَخْرَجُوكُمْ
(And kill them wherever you find them, and turn them out from where they have turned you out),
meaning, `Your energy should be spent on fighting them, just as their energy is spent on fighting you, and on expelling them from the areas from which they have expelled you, as a law of equality in punishment.'
The Prohibition of mutilating the Dead and stealing from the captured Goods
Allah said;
وَلَا تَعْتَدُواْ إِنَّ اللّهَ لَا يُحِبِّ الْمُعْتَدِينَ
but transgress not the limits. Truly, Allah likes not the transgressors.
This Ayah means,
`Fight for the sake of Allah and do not be transgressors,' such as, by committing prohibitions.
Al-Hasan Al-Basri stated that transgression (indicated by the Ayah),
"includes mutilating the dead, theft (from the captured goods), killing women, children and old people who do not participate in warfare, killing priests and residents of houses of worship, burning down trees and killing animals without real benefit."
This is also the opinion of Ibn Abbas, Umar bin Abdul-Aziz, Muqatil bin Hayyan and others.
Muslim recorded in his Sahih that Buraydah narrated that Allah's Messenger said;
اغْزُوا فِي سَبِيلِ اللهِ قَاتِلُوا مَنْ كَفَرَ بِاللهِ اغْزُوا وَلَا تَغُلُّوا وَلَا تَغْدِرُوا وَلَا تَمْثُلُوا وَلَا تَقْتُلُوا وَلِيدًا وَلَا أَصْحَابَ الصَّوَامِع
Fight for the sake of Allah and fight those who disbelieve in Allah. Fight, but do not steal (from the captured goods), commit treachery, mutilate (the dead), or kill a child, or those who reside in houses of worship.
It is reported in the Two Sahihs that Ibn Umar said,
"A woman was found dead during one of the Prophet's battles and the Prophet then forbade killing women and children."
There are many other Hadiths on this subject.
Shirk is worse than Killing
Allah says;