It has been narrated on the authority of `Umar b. al-Khattab who said
When it was the day on which the Battle of Badr was fought, the Messenger of Allah (ﷺ) cast a glance at the infidels, and they were one thousand while his own Companions were three hundred and nineteen. The Prophet (ﷺ) turned (his face) towards the Qibla. Then he stretched his hands and began his supplication to his Lord: "O Allah, accomplish for me what Thou hast promised to me. O Allah, bring about what Thou hast promised to me. O Allah, if this small band of Muslims is destroyed. Thou will not be worshipped on this earth." He continued his supplication to his Lord, stretching his hands, facing the Qibla, until his mantle slipped down from his shoulders. So Abu Bakr came to him, picked up his mantle and put it on his shoulders. Then he embraced him from behind and said: Prophet of Allah, this prayer of yours to your Lord will suffice you, and He will fulfill for you what He has promised you. So Allah, the Glorious and Exalted, revealed (the Qur'anic verse): "When ye appealed to your Lord for help, He responded to your call (saying): I will help you with one thousand angels coming in succession." So Allah helped him with angels. Abu Zumail said that the hadith was narrated to him by Ibn `Abbas who said: While on that day a Muslim was chasing a disbeliever who was going ahead of him, he heard over him the swishing of the whip and the voice of the rider saying: Go ahead, Haizum! He glanced at the polytheist who had (now) fallen down on his back. When he looked at him (carefully he found that) there was a scar on his nose and his face was torn as if it had been lashed with a whip, and had turned green with its poison. An Ansari came to the Messenger of Allah (ﷺ) and related this (event) to him. He said: You have told the truth. This was the help from the third heaven. The Muslims that day (i.e. the day of the Battle of Badr) killed seventy persons and captured seventy. The Messenger of Allah (ﷺ) said to Abu Bakr and `Umar (Allah be pleased with them): What is your opinion about these captives? Abu Bakr said: They are our kith and kin. I think you should release them after getting from them a ransom. This will be a source of strength to us against the infidels. It is quite possible that Allah may guide them to Islam. Then the Messenger of Allah (ﷺ) said: What is your opinion, Ibn Khattab? He said: Messenger of Allah, I do not hold the same opinion as Abu Bakr. I am of the opinion that you should hand them over to us so that we may cut off their heads. Hand over `Aqil to `Ali that he may cut off his head, and hand over such and such relative to me that I may cut off his head. They are leaders of the disbelievers and veterans among them. The Messenger of Allah (ﷺ) approved the opinion of Abu Bakr and did not approve what I said. The next day when I came to the Messenger of Allah (ﷺ), I found that both he and Abu Bakr were sitting shedding tears. I said: Messenger of Allah, why are you and your Companion shedding tears? Tell me the reason. For I will weep, or I will at least pretend to weep in sympathy with you. The Messenger of Allah (ﷺ) said: I weep for what has happened to your companions for taking ransom (from the prisoners). I was shown the torture to which they were subjected. It was brought to me as close as this tree. (He pointed to a tree close to him.) Then God revealed the verse: "It is not befitting for a prophet that he should take prisoners until the force of the disbelievers has been crushed..." to the end of the verse: "so eat ye the spoils of war, (it is) lawful and pure. So Allah made booty lawful for them."