Narrated Abu Huraira:Allah's Apostle sent a Sariya of ten men as spies under the leadership of 'Asim bin Thabit al-Ansari, the grandfather of 'Asim bin Umar Al-Khattab. They proceeded till they reached Hadaa, a place between 'Usfan, and Mecca, and their news reached a branch of the tribe of Hudhail called Bani Lihyan. About two-hundred men, who were all archers, hurried to follow their tracks till they found the place where they had eaten dates they had brought with them from Medina. They said, "These are the dates of Yathrib (i.e. Medina), "and continued following their tracks When 'Asim and his companions saw their pursuers, they went up a high place and the infidels circled them. The infidels said to them, "Come down and surrender, and we promise and guarantee you that we will not kill any one of you" 'Asim bin Thabit; the leader of the Sariya said, "By Allah! I will not come down to be under the protection of infidels. O Allah! Convey our news to Your Prophet. Then the infidels threw arrows at them till they martyred 'Asim along with six other men, and three men came down accepting their promise and convention, and they were Khubaib-al-Ansari and Ibn Dathina and another man So, when the infidels captured them, they undid the strings of their bows and tied them. Then the third (of the captives) said, "This is the first betrayal. By Allah! I will not go with you. No doubt these, namely the martyred, have set a good example to us." So, they dragged him and tried to compel him to accompany them, but as he refused, they killed him. They took Khubaid and Ibn Dathina with them and sold them (as slaves) in Mecca (and all that took place) after the battle of Badr. Khubaib was bought by the sons of Al-Harith bin 'Amir bin Naufal bin 'Abd Manaf. It was Khubaib who had killed Al-Harith bin 'Amir on the day (of the battle of) Badr. So, Khubaib remained a prisoner with those people.
Al-Harith had told him, "When those people gathered (to kill Khubaib) he borrowed a razor from me to shave his pubes and I gave it to him. Then he took a son of mine while I was unaware when he came upon him. I saw him placing my son on his thigh and the razor was in his hand. I got scared so much that Khubaib noticed the agitation on my face and said, 'Are you afraid that I will kill him? No, I will never do so.' By Allah, I never saw a prisoner better than Khubaib. By Allah, one day I saw him eating of a bunch of grapes in his hand while he was chained in irons, and there was no fruit at that time in Mecca." The daughter of Al-Harith used to say, "It was a boon Allah bestowed upon Khubaib." When they took him out of the Sanctuary (of Mecca) to kill him outside its boundaries, Khubaib requested them to let him offer two Rakat (prayer). They allowed him and he offered Two Rakat and then said, "Hadn't I been afraid that you would think that I was afraid (of being killed), I would have prolonged the prayer. O Allah, kill them all with no exception." (He then recited the poetic verse):-- "I being martyred as a Muslim, Do not mind how I am killed in Allah's Cause, For my killing is for Allah's Sake, And if Allah wishes, He will bless the amputated parts of a torn body" Then the son of Al Harith killed him. So, it was Khubaib who set the tradition for any Muslim sentenced to death in captivity, to offer a two-Rak'at prayer (before being killed). Allah fulfilled the invocation of Asim bin Thabit on that very day on which he was martyred. The Prophet informed his companions of their news and what had happened to them. Later on when some infidels from Quraish were informed that Asim had been killed, they sent some people to fetch a part of his body (i.e. his head) by which he would be recognized. (That was because) 'Asim had killed one of their chiefs on the day (of the battle) of Badr. So, a swarm of wasps, resembling a shady cloud, were sent to hover over Asim and protect him from their messenger and thus they could not cut off anything from his flesh.