Sahih al-Bukhari 3045
Abul Yaman narrated to us that Shu'aib told us. He narrated from Zuhri that he said: Amr bin Abi Sufyan bin Asid bin Jariyah Thaqafi told me, and he was an ally of Banu Zuhrah and one of the companions of Hazrat Abu Hurairah (ra), that Hazrat Abu Hurairah (ra) said: The Messenger of Allah (saw) sent a party of ten men to gather information and appointed Asim bin Thabit Ansari (ra), who was the maternal grandfather of Asim bin Umar bin Khattab, as its leader. These people set off. When they reached a place called Had'ah, which is between Usfan and Mecca, someone informed Banu Lihyan, a branch of the tribe of Hudhail, about them. Hearing this news, about two hundred men of Banu Lihyan, all of them archers, set out. They followed them on their footprints until they found the place where they had eaten dates which they had taken from Medina as provisions. They said (on seeing the stones): These are dates of Yathrib. They followed them on their footprints. When Asim (ra) and his companions saw them coming, they took refuge on a mound. Those people surrounded them and said to them: Come down and surrender yourselves to us, and (on our part) you have this covenant and pledge that we will not kill any one of you. Asim bin Thabit (ra), who was the leader of this party, said: As for my surrendering myself, by Allah, today I will not come down from the mound under the protection of a disbeliever. O Allah, inform Your Prophet (saw) about us. Those people shot arrows at them and killed Asim (ra) along with seven men. Seeing this, three men came down to them, relying on the covenant and pledge. Among them were Khubaib Ansari (ra), Ibn Dathinah (ra) and one other man. When they had overpowered them, they undid the strings of their bows and tied their arms tightly. The third man said: This is the first treachery. By Allah, I will not go with you. For me there is a comforting example in those who have been martyred. They dragged him and struggled to make him go with them somehow, but he refused. At last they killed him, and they took Khubaib (ra) and Ibn Dathinah (ra) and went and sold them in Mecca. This happened after the Battle of Badr, and Khubaib (ra) was bought by Banu Harith bin Amir bin Naufal bin Abd Manaf, and it was Khubaib (ra) who had killed Harith bin Amir on the day of Badr. Khubaib (ra) remained a captive with them. (Ibn Shihab used to say that) Ubaidullah bin Iyad told me that the daughter of Harith mentioned to him that when they had agreed (to kill him), Khubaib (ra) asked her for a razor to use it. So she gave him the razor. At that time, without my being aware, a little child of mine came to Khubaib (ra) and he took him. She said: I saw Khubaib (ra) seating him on his thigh with the razor in his hand. Seeing this I was so frightened that Khubaib (ra) recognised the fright on my face and said: You fear that I will kill him. I am not one to do this. By Allah, I have never seen a captive better than Khubaib (ra). By Allah, one day I saw him with a bunch of grapes in his hand, eating grapes from it, and he was bound in chains, and in those days there was no fruit in Mecca. She used to say: This was provision from Allah which He gave to Khubaib (ra). When the people took him out of the Sacred Precinct (Haram) to kill him at a place that is not within the Haram, Khubaib (ra) said to them: Permit me to offer two Rak'ahs of Prayer (Salat) {and they permitted him, so he offered two Rak'ahs} and he said: If you would not think that the state (of Prayer) I am in at this time is the result of fear, I would certainly have made this Prayer long. O Allah, destroy them one by one. (Then he (ra) recited these verses:) Since I am being killed in a state of being a Muslim, I do not care on which side I fall for the sake of Allah, and this falling of mine is for the sake of Allah, and if He wills, He can bless the joints of a body torn to pieces. At last the son of Harith killed him, and it was Khubaib who established the practice (Sunnah) of offering two Rak'ahs for every Muslim who is killed in captivity. Allah accepted the prayer of Asim bin Thabit (ra) on the day he was martyred, and the Prophet (saw) told his Companions what had happened to these people and what hardship had befallen them. And when some people told the disbelievers of Quraish that Asim (ra) had been killed, they sent some men to Asim (ra) to bring a part of his body by which he could be recognised, for Asim (ra) had killed one of their great men on the day of Badr. Then a swarm of hornets was sent over the body of Asim (ra), which surrounded it from above like a canopy, and in this way his body was protected from the men sent by the disbelievers, and they could not cut any piece from his flesh.
AI-translated by Islam-Today
Book 170: The performance of a two Rak'a Salat before being put to death