The verse in question here is the following: “[Remember] when your Lord inspired to the angels, ‘I am with you, so strengthen those who have believed. I will cast terror into the hearts of those who disbelieved, so strike [them] upon the necks and strike from them every fingertip'” (Quran 8:12). If one reads the context of this verse, it is clear that Allah is talking about a war where the disbelievers attacked the Muslims. Specifically, this verse is referring to the Battle of Badr, where the disbelievers travelled hundreds of miles to attack and kill the Muslims who were much smaller in number.
And Allah knows best.