We went forward with God’s Messenger, and when we reached Dhat ar-Riqa‘ we came to a shady tree which we left for him. One of the polytheists came along and seeing the sword of God’s Messenger hanging on a tree he took it, drew it from the scabbard and said to him, "Are you afraid of me?” On being told that he was not, he asked, “Who will protect you from me?” He replied, “God will protect me from you.” Then the companions of God’s Messenger threatened him, and he sheathed the sword and hung it up. The call to prayer was made and he led a section in two rak'as, after which they withdrew and he led the other section in two rak'as, so that God’s Messenger prayed four rak'as and the people prayed two.
Yazid b. Ruman told on the authority of Salih b. al-Khawwat on the authority of one who prayed in time of danger along with God’s Messenger at the battle of Dhat ar-Riqa'* that a section formed a line along with him and a section faced the enemy. He led the section which was along with him in a rak'a, then remained standing while they finished the prayer by themselves. They then departed and drew up in line facing the enemy, and when the other party came he led them in the remaining rak'a of his prayer, after which he remained seated while they finished the prayer by themselves. He then led them in uttering the salutation.
* This was during an expedition against some sections of Ghatafan in 4 A.H
(Bukhari and Muslim.) Bukhari rendered it also by another line from al-Qasim from Salih b. al-Khawwat from Sahl b. Abu Hathma from the Prophet.
God’s Messenger led us in the prayer in time of danger and we drew up in two rows behind him with the enemy between us and the qibla. The Prophet said, "God is most great” and we all said it; then he bowed and we all bowed; then he raised his head after bowing and we all raised ours; then he and the row next him went down in prostration while the rear row stood facing the enemy; then when the Prophet finished the prostration and the row next him stood up, the rear row went down in prostration; then they stood up; then the rear row went to the front and the front row to the rear; then the Prophet bowed and we all bowed; then he raised his head after bowing and we all raised ours; then he and the row next him which had been in the rear in the first rak'a went down in prostration while the rear row stood facing the enemy; then when the Prophet and the row next him finished the prostration the rear row went down and prostrated them selves; then the Prophet, uttered the salutation and we all did so.
Narrated Salim b. ‘Abdallah b. ‘Umar quoted his father as saying:
I went on an expedition with God’s Messenger to Najd, and when we came in front of the enemy we drew up in line facing them. God’s Messenger then stood up and led us in prayer, and one section stood up along with him while another faced the enemy. He prayed a rak'a with those who were with him and made two prostrations, and then they changed places with those who had not prayed. When they came God’s Messenger prayed a rak'a with them and made two prostrations, then he uttered the salutation and each of them got up and left, after which he prayed a rak'a alone and made two prostrations. Nafi‘ transmitted something similar, adding that when there was greater cause for fear than on that occasion they prayed standing on their feet or mounted, without considering whether or not they were facing the qibla. Nafi‘ said he thought God’s Messenger was the one on whose authority Ibn ‘Umar mentioned that.