Several months after arriving in Medina, the Muslims began attacking the Meccan caravans. It is very difficult to understand how someone who claims to be a prophet of God could accept the carnal, pagan Arab practice of depriving the caravans of other tribes. It can call the "pursuit the way of God" and then can still say that one fifth of the prey belongs to God! This practice eventually led to the attack by the Quraish from Mecca in several battles, beginning with the Battle of Badr in 624. At that time the permission to self-defense was given. The only enemy at this time were the "unbelievers" of the tribe of the Quraish of Mecca. According to Muhammad, they were idol worshipers.
Permission to fight is given to those (i.e. believers against disbelievers), who are fighting them, (and) because they (believers) have been wronged, and surely, Allah is Able to give them (believers) victory (22:39)
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. (22:40)
Those (Muslim rulers) who, if We give them power in the land, (they) order for Iqamat-as-Salat. [i.e. to perform the five compulsory congregational Salat (prayers) (the males in mosques)], to pay the Zakat and they enjoin Al-Ma'ruf (i.e. Islamic Monotheism and all that Islam orders one to do), and forbid Al-Munkar (i.e. disbelief, polytheism and all that Islam has forbidden) [i.e. they make the Qur'an as the law of their country in all the spheres of life]. And with Allah rests the end of (all) matters (of creatures). (22:41)
Several translators have not noticed that yuqataluna is in the passive voice: "against which war is made" and not as e.g. Sale has translated it: "take the weapons against the unbelievers".
This was the first occasion on which the fighting - in self-defense - was permitted. This place comes undoubtedly from Medina.
To allow a righteous people to fight a wild and disastrous nation was perfectly justified. But the background of justification was much more important here, as the small Muslim community was fighting not only for their own existence against the Meccan tribe of Quraish but also for the existence of their faith in the One God.
Those who emigrated in the Cause of Allah and after that were killed or died, surely, Allah will provide a good provision for them. And verily, it is Allah Who indeed is the Best of those who make provision.
In the quotation of Brigadier S.K. Malik in his book "The Koranic Concept of War" is told of three stages of teaching about the war in the Koran:
The Muslim migration to Medina in its traces brought events and decisions of far-reaching significance. In Mecca they had neither proclaimed an Ummah (a people or a community), nor were they allowed to take up arms against their oppressors.
In Medina, a divine revelation proclaimed them an "Ummah" and gave them permission to take up arms against their oppressors.
Soon after, permission was transformed into a divine commandment which made it a religious obligation for believers to use arms against their adversaries.
Jihad in the Koran Phase 3: (Medina) - Defensive combat is commanded