These verses are related to the battle of Badr (Tafsir al-Jalalayn, Tanwir al-Miqbas min Tafsir Ibn Abbas, Asbab Al-Nuzul by Al-Wahidi, Ibn Kathir and Dr. Muhammad Asad).
8:15 O you who have believed, when you meet those who disbelieve advancing [for battle], do not turn to them your backs [in flight].
8:16 And whoever turns his back to them on such a day, unless swerving [as a strategy] for war or joining [another] company, has certainly returned with anger [upon him] from Allah, and his refuge is Hell – and wretched is the destination.
8:17 And you did not kill them, but it was Allah who killed them. And you threw not, [O Muhammad], when you threw, but it was Allah who threw that He might test the believers with a good test. Indeed, Allah is Hearing and Knowing.
In Quran 8:15, God orders the Muslims who were engaging in the battle of Badr (624 AD) not to turn their backs from the enemy Quraysh (Tanwir al-Miqbas min Tafsir Ibn ‘Abbas and Tafsir al-Jalalayn).
In 8:16 Muslims in the battle of Badr are warned not run away from engaging the hostile Quraysh. And if any of them were run away, they would get punished in the hereafter for not defending community (Tanwir al-Miqbas min Tafsir Ibn ‘Abbas and Tafsir al-Jalalayn).
8:17 – God states here that it wasn’t the Muslims who slew the Quraysh combatants, but it was God. HE was the one who gave assistance at the battle of Badr (624 AD).
Some use these quotes to show that violence against innocent people are endorsed. And they ‘claim’ that the early Muslims only wanted war, war and more war. However, as we have read its historical context, we see that the violence was started by the Quraysh, when they continuously attacked the Muslims, pre-battle of Badr: “Did Quraysh Persecute Muslims When They Fled To Madinah?”
Furthermore, the aim of the Muslims then was to stop the hostilities by the Quraysh against Muslims. The following verse states:
“If you [disbelievers] seek the victory – the defeat has come to you. And if you desist [from hostilities], it is best for you; but if you return [to war], We will return, and never will you be availed by your [large] company at all, even if it should increase; and [that is] because Allah is with the believers.” – Quran 8:19
Reading the above verse and the verses before it, we see that the Muslims did not want to engage in battle against them. The only reason the Muslims engaged in fighting them was as a result of them not desisting from persecuting innocents. Hence, the Muslims then were only fighting to save themselves and their community, and be free to practice their religion without getting persecuted (Tafsir al-Tustari).
Dr. Muhammad Asad:
“17 I.e., in flight: the implication being that in view of God’s promise of victory no retreat is permissible. Since this verse (like the whole of this surah) relates predominantly to the battle of Badr, it may well be presumed that the above admonition forms part of the message of encouragement beginning with the words, “I am with you” (verse 12), which God commanded the angels to convey to the believers before the battle. In accordance with the didactic method of the Qur’an, however, the moral lesson contained in this verse is not confined to the historical occasion to which it refers, but has the validity of a permanent law.
18 Lit., “you did not slay them – i.e., in the battle of Badr, which ended with a complete victory of the Muslims.
19 According to several Traditions, the Prophet cast, at the beginning of the battle, a handful of pebbles or dust in the direction of the enemy, thus symbolically indicating their approaching defeat. However, none of these accounts attains to the standard of authenticity described as sahih (i.e., “reliable”) by the great exponents of the science of Tradition (‘ilm al-hadith), and cannot, therefore, satisfactorily explain the above Qur’anic passage (see Ibn Kathir’s commentary on this verse, as well as Manar IX, 620 f.). Since the verb rams (lit., “he cast” or “flung”) applies also to the act of “shooting an arrow” or “flinging a spear”, it might be explained here as a reference to the Prophet’s active participation in the battle. Alternatively, it may denote his “casting terror”, i.e., into the hearts of his enemies, by his and his followers’ extreme valour. Whichever explanation is adopted, the above verse implies that the victory of the Muslims over the much more numerous and much better equipped army of the Quraysh was due to God’s grace alone: and, thus, it is a reminder to the faithful, of all times, not to indulge in undue pride in any of their achievements (which is the meaning of the “test” mentioned in the next sentence).
20 Lit., ‘from Himself’.” 
Maulana Muhammad Ali:
“15a. Zahafa originally means he walked or marched little by little, and applies to the crawling along of a child when unable to walk. Then zahf came to mean an army or military force marching little by little towards the enemy, or heavily by reason of their multitude and force (LL). Thus it became synonymous with war, as in a hadith quoted by T, farra min al-zahf, which means he fled from war (LL).
17a. Rama carries a number of significances, throwing, flinging, casting, assailing, smiting, shooting, going forth, etc. (LL). It is used in connection with fighting, and therefore I adopt smiting as its equivalent, which, like its original, makes the meaning clear without seeking an understood object. The first part of the verse refers to the Muslims generally — So you slew them not, but Allah slew them, the address being in the plural; and the second part, being in the singular, is understood as referring to the Holy Prophet. Otherwise there is no difference between the two passages. The Muslims slew the enemy, but it is affirmed that really they did not slay, but it was Allah Who slew them; the meaning apparently being that Allah’s hand was working in the battle, which is also clear from the fact that three hundred, mostly raw, young men, equipped with neither horses nor arms, prevailed against a thousand of the most renowned warriors. The same meaning must be attached to the other passage relating to the smiting of the enemy. Whether the Prophet actually threw a handful of pebbles at the enemy, which discomfited the latter, is a different question. It is sufficient to learn that a powerful enemy was discomfited by about a third of its number, while from the point of view of efficiency and equipment even ten men from among the Muslims were not equal to one of the enemy. It was Allah’s hand that slew them, and it was His hand that smote them and ultimately put them to rout. That the Prophet actually threw a handful of dust at the enemy is in no way inconsistent with this explanation.
17b. Ibla’, though ordinarily meaning trying, and proving, like bala’ and ibtila’ (two other verbs from the same root), means here, by the unanimous opinion of all commentators, the conferring of a favour (Rz). The lexicons also give it the same significance. Thus LL explains the words abla-hu bala’-an hasan-an as meaning, God did to him a good deed or conferred a benefit on him. The good gift or the benefit spoken of here is a victory which strengthened the foundations of Islam, and dealt a death-blow to the evil designs of those who were determined to exterminate it, as is plainly stated in the next verse.” 
Don’t forget to follow Discover The Truth on Facebook and Twitter. PLEASE help spread the word by sharing our articles on your favourite social networks.
 The Message of The Quran translated and explained by Muhammad Asad, page 346 – 347 https://www.usc.edu/schools/college/crcc/private/cmje/religious_text/The_Message_of_The_Quran__by_Muhammad_Asad.pdf
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction by Maulana Muhammad Ali, page 380 – 381