When were the Muslims permitted to fight and retaliate?
After the Muslims migrated from Makkah to Madinah to practice Islam more freely, the Quraish continued their onslaught and harmful attacks on the Muslims, despite being based in a different city. Allah, the Most High, revealed to the Prophet (ﷺ) and gave the Muslims permission to take arms against the disbelievers and retaliate in this verse:
“Permission to fight is given to those (i.e., Believers against those disbelievers), who are fighting them, (and) because they (believe) have been wronged, and surely Allah is able to give them (believers) victory” 
This permission was revealed in Madinah, and the Muslims were better equipped to defend Islam at that stage. After being forbearing in Makkah and suffering under the Quraish, Allah permitted the Muslims to respond in defense. 
 Surah al-Hajj, 22:39
 Mubarakpuri, The Sealed Nectar, 91< Back to Questions