The Qur'an describes the situation in its own inimitable manner:
"If you believe in Allah and (in his hidden help) and in the revelation we sent down to our servant on the day of testing—the day of the meeting of the two forces. For Allah (SWT) has power over all things. Remember you were on the hither side and they on the farther side and the caravan on lower ground then you.
Even if you had made a mutual appointment to meet
You would certainly have failed in the appointment.
But thus you met that Allah (SWT) might accomplish a matter already enacted that those who die might die after a clear sign had been pven and these who lived might live after a clear sign (had been given) and verily Allah (SWT) is He who hears and known (all things).(8:41-42)
And He says:
"And Allah helped you at Badr when you were a contemplible force, then fear Allah, Thus may you show your gratitude. Remember, you said to the faithful; 'Is it not enough for you that Allah should help you with three thousand angelsl (specially) sent down?
Yes, if you remain firm and act right, even if the enemy should rush here on you in hot haste, your Lord would help you with five thousand Angels, making a terrific onslaught.
Allah made it but a message of hope for you and an assurance to your hearts: (in any case) There is no help except from Allah, the Exalted, the Wise.
That He may cut off a fringe of the unbelievers or expose them to infamy and they should then be turned back, frustrated of their purpose." (3:123-127)