Abu Hurayrah (may Allah be pleased with him) reported: The Messenger of Allah (may Allah's peace and blessings be upon him) dispatched a secret troop of ten men under the leadership of ‘Āsim ibn Thābit al-Ansāri (may Allah be pleased with him). They proceeded until they reached Al-Had'ah, a place between ‘Usfān and Makkah, when the news reached a branch of the tribe of Hudhayl called Banu Lihyān. About one hundred of their archers hurried to track them. When ‘Āsim and his companions sensed them, they took refuge in a safe place. Their trackers circled them and said: "Come down and surrender. We give you our pledge and covenant that we will not kill any of you." ‘Āsim ibn Thābit (may Allah be pleased with him) said: "O people, as for me, I will not go down to be under the protection of disbelievers. O Allah, let your Prophet know what has happened to us." The disbelievers then shot arrows at them until they killed ‘Āsim. Three of the men went down trusting their pledge and covenant; Khubayb, Zayd ibn Ad-Dathinnah, and a third man. When the disbelievers captured them and tied them up with the strings of their bows, the third companion said: "This is the start of a betrayal. By Allah, I will not go with you. I have a clear example in these (killed companions)." So they dragged him and tried to force him to accompany them, but he refused, so they killed him. They took Khubayb and Zayd ibn Ad-Dathinnah with them and sold them as slaves in Makkah. This incident took place after the battle of Badr. Khubayb was bought by the children of Al-Hārith ibn ‘Āmir ibn Nawfal ibn ‘Abd Manāf. It was Khubayb who had killed Al-Hārith in the battle of Badr. Khubayb remained as their prisoner for a several days, until they decided to kill him. Khubayb borrowed a razor from one of Al-Hārith’s daughters to shave his pubic hair. Without her being aware, her little son crawled towards Khubayb. When she saw her son on Khubayb's knee and he had the razor in his hand, she was so alarmed that Khubayb noticed the agitation on her face. He said: "Are you afraid that I will kill him? No, I will never do that." She later commented: "By Allah, I never saw a prisoner better than Khubayb. By Allah, I once saw him eating a bunch of grapes from his hand while he was chained up, but there was no such fruit at that time in Makkah. It must have been a blessing that Allah had bestowed upon Khubayb." When they took him out of the Sacred Precincts, so they could kill him outside its boundaries, Khubayb asked them to let him pray two Rak‘ahs. They allowed him to do so, so he offered the two Rak‘ahs. Then he said: "Had I not reckoned that you would think that I was anxious, I would have prayed more. O Allah, remove them altogether; slay them one by one and spare none of them." He then recited these poetic verses: "I do not care how I will be killed as long as I will die in the cause of Allah, as a Muslim. This is for Allah's sake, and if He so wills, He may bless torn and amputated limbs." It was therefore Khubayb who established the Sunnah (practice) for any Muslim who is about to be killed to pray two Rak‘ahs. The Messenger of Allah (may Allah’s peace and blessings be upon him) related to his Companions what had happened to the ten Companions on the day that it happened. Later, when some disbelievers from the Quraysh were informed that ‘Āsim had been killed; they sent people to fetch a recognizable part of him to confirm his death. They did so, because ‘Āsim had previously killed one of their chiefs. So Allah sent a swarm of bees, resembling a shady cloud, to hover over the body of ‘Āsim to shield him from their messengers, so they could not cut off any part of him.
Authentic hadith - Narrated by Bukhari