The Prophet (Peace and blessings of Allah upon him) did not wield a sword with which to force people to enter Islam, for the Qur'an is crystal clear in its refusal of this concept. Allah(Almighty) has said:
There shall be no compulsion in [acceptance of] the religion. (2:256) Then, would you compel the people in order that they become believers? (10:99) For you is your religion, and for me is my religion. (109:6) But this does not mean that the state should remain powerless in the face of internal or external aggression, for Allah(Almighty) has given the believers permission to defend themselves and to restore their rights in proportion to the injustice done to them, but not more than that.
And Allah(Almighty), said:
So whoever has assaulted you, then assault him in the same way that he has assaulted you. (2:194) Fight in the way of Allah those who fight you but do not transgress. (2:190) But if they fight you, then kill them. (2:191)
This shows that the legality of war is confined to self defence and protection of the Ummah from aggression and conspiracies from within and from without. When we look at the history of armed conflict in Islam, this fact is confirmed. For when the Makkans' oppression increased, they compelled the Prophet (Peace and blessings of Allah upon him) to leave his home after having plotted to kill him, and it was they who began aggression against the Muslims by unjustly forcing them to leave their homes. So, after the Hijrah, Allah(Almighty) permitted the emigrants to fight the polytheists of Quraysh, saying: Permission [to retaliate] has been given to those who are being fought, because they were wronged, and indeed, Allah is competent to give them victory. [They are] those who have been evicted from their homes without right – only because they say, "Our Lord is Allah." (22:39-40) Thus, the Prophet (Peace and blessings of Allah upon him) was first to oppose only the Quraysh and not the other Arabs.
But when other Arab polytheists besides the people of Makkah turned against the Muslims and allied themselves with their enemies, Allah(Almighty) ordered them to fight all of the polytheists, and said:
And fight against the disbelievers collectively as they fight against you collectively. (9:36)
This is how jihad became general against all of the pagans who had no divine scripture, and it is the affirmation of the Prophet's (Peace and blessings of Allah upon him) saying,
"I have been commanded to fight the people until they say, 'La ilaha ill-Allah', so if they say it their lives and properties are protected from me by its right, and their account is with Allah." (Al-Bukhari and Muslim)
And when the Muslims found betrayal from the Jews after they broke the treaty and aided the polytheists in their war, Allah(Almighty) ordered fighting against them also, saying:
If you fear from a people betrayal, throw [their treaty] back to them, [putting you] on equal terms. Indeed, Allah does not like traitors. (8:5) Fighting them became obligatory until they offered the jizyah tax in submission so that Muslims would be safe from them.
Similarly, the Prophet (Peace and blessings of Allah upon him) did not begin hostilities with the Christians. Shaykh al-Islam Ibn Taymiyyah said, "He did not fight against any of the Christians until after he sent his messengers, following the treaty of Hudaybiyyah, to all the rulers, inviting them to Islam. He sent them to Caesar, Chosroes, al-Muqawqas, an-Najashi and the Arab rulers to the east and the north. Some of them entered Islam, but the Christians of Syria deliberately killed some of their dignitaries who had embraced Islam. So, the Christians had first fought the Muslims and then killed those of their people who accepted Islam out of tyranny and injustice. Otherwise, the Prophet (Peace and blessings of Allah upon him) had sent his messengers to invite people to Islam voluntarily, not forcefully. He(Peace and blessings of Allah upon him) never compelled anyone to accept Islam."
Thus, the battles of Allah's Messenger (Peace and blessings of Allah upon him) were based on the following principles:
1. The polytheists of Quraysh were considered enemy combatants because they initiated aggression.
2. The Jews were observed to have betrayed and gone over to the side of the polytheists.
3. Any Arab tribe that transgressed against the Muslims was to be fought until it accepted Islam.
4. Jews and Christians who committed aggression were to be fought until they accepted Islam or paid the jizyah tax.
5. Anyone who enters Islam has protected his life and property, and Islam cancels what occurred before it.