Sayyiduna Umar bin al-Khattab (may Allah be pleased with him) narrates: When the Battle of Uhud came the following year, they were punished for what they had done at Badr in taking ransom. Seventy of them were killed, and the Companions of the Prophet (peace and blessings be upon him) scattered, leaving him. The blessed tooth of the Prophet (peace and blessings be upon him) was injured, his helmet was driven into his head, and his blood flowed down onto his face. Concerning this, Allah Almighty revealed this verse: "Why is it that when a calamity struck you, although you had (previously) inflicted twice as much (on the enemy), you said: 'Where has this come from?' Say (O Messenger): 'It is from yourselves (that is, because of you).' Indeed, Allah Almighty has power over all things." That is, it was because of the ransom you had taken.
Al-Tabarani recorded it at the end of the hadith of Sayyiduna Umar (may Allah be pleased with him) which is in the "Sahih", in his large "Musnad".