Allah's Signs displayed during Badr, And throwing Sand in the Eyes of the Disbelievers
Allah states that He creates the actions that the servants perform and that whatever good actions they take, it is He Who should be praised for them, for He directed and helped them perform these actions.
Allah said,
فَلَمْ تَقْتُلُوهُمْ وَلَـكِنَّ اللّهَ قَتَلَهُمْ
You killed them not, but Allah killed them.
meaning, it is not because of your power and strength that you killed the pagans, who were many while you were few. Rather, it is He Who gave you victory over them, just as He said in another Ayah,
وَلَقَدْ نَصَرَكُمُ اللَّهُ بِبَدْرٍ وَأَنتُمْ أَذِلَّةٌ
And Allah has already made you victorious at Badr, when you were a weak little force. (3;123)
and,
لَقَدْ نَصَرَكُمُ اللَّهُ فِى مَوَاطِنَ كَثِيرَةٍ وَيَوْمَ حُنَيْنٍ إِذْ أَعْجَبَتْكُمْ كَثْرَتُكُمْ فَلَمْ تُغْنِ عَنكُمْ شَيْياً وَضَاقَتْ عَلَيْكُمُ الَارْضُ بِمَا رَحُبَتْ ثُمَّ وَلَّيْتُم مُّدْبِرِينَ
Truly, Allah has given you victory on many battlefields, and on the day of Hunayn when you rejoiced at your great number, but it availed you naught and the earth, vast as it is, was straitened for you, then you turned back in flight. (9;25)
Allah, the Exalted and Ever High, states that victory does not depend on numbers or collecting weapons and shields. Rather, victory is from Him, Exalted He is.
كَم مِّن فِيَةٍ قَلِيلَةٍ غَلَبَتْ فِيَةٍ كَثِيرَةً بِإِذْنِ اللَّهِ وَاللَّهُ مَعَ الصَّـبِرِينَ
How often has a small group overcome a mighty host by Allah's leave!" And Allah is with the patient. (2;249)
Allah then mentioned the handful of sand that His Prophet threw at the disbelievers during the day of Badr, when he went out of his bunker. While in the bunker, the Prophet invoked Allah humbly and expressing his neediness before Allah. He then threw a handful of sand at the disbelievers and said,
شَاهَتِ الْوُجُوه
(Humiliated be their faces).
He then commanded his Companions to start fighting with sincerity and they did. Allah made this handful of sand enter the eyes of the idolators, each one of them were struck by some of it and it distracted them making each of them busy.
Allah said,
وَمَا رَمَيْتَ إِذْ رَمَيْتَ وَلَـكِنَّ اللّهَ رَمَى
And you threw not when you did throw, but Allah threw.
Therefore, it is Allah Who made the sand reach their eyes and busied them with it, not you (O Muhammad).
وَلِيُبْلِيَ الْمُوْمِنِينَ مِنْهُ بَلء حَسَناً
that He might test the believers by a fair trial from Him.
Muhammad bin Ishaq said that Muhammad bin Jafar bin Az-Zubayr narrated to him that Urwah bin Az-Zubayr said;
"So that the believers know Allah's favor for them by giving them victory over their enemy, even though their enemy was numerous, while they were few. They should thus know His right and express gratitude for His favor on them."
Similar was said by Ibn Jarir.
It is stated in a Hadith,
وَكُلَّ بَلَءٍ حَسَنٍ أَبْلَنَا
Every trial (from Allah) is a favor for us.
Allah said next,
إِنَّ اللّهَ سَمِيعٌ عَلِيمٌ
Verily, Allah is All-Hearer, All-Knower.
Allah hears the supplication and knows those who deserve help and triumph.
Allah said,
ذَلِكُمْ وَأَنَّ اللّهَ مُوهِنُ كَيْدِ الْكَافِرِينَ