Sahih al-Bukhari, Hadith 4535

Narrated Nafi`: Whenever `Abdullah bin `Umar was asked about Salat-al-Khauf (i.e. prayer of fear) he said, "The Imam comes forward with a group of people and leads them in a one rak`a prayer while another group from them who has not prayed yet, stay between the praying group and the enemy. When those who are with the Imam have finished their one rak`a, they retreat and take the positions of those who have not prayed but they will not finish their prayers with Taslim. Those who have not prayed, come forward to offer a rak`a with the Imam (while the first group covers them from the enemy). Then the Imam, having offered two rak`at, finishes his prayer. Then each member of the two groups offer the second rak`a alone after the Imam has finished his prayer. Thus each one of the two groups will have offered two rak`at. But if the fear is too great, they can pray standing on their feet or riding on their mounts, facing the Qibla or not." Nafi` added: I do not think that `Abdullah bin `Umar narrated this except from Allah's Messenger (See Hadith No. 451, Vol 5 to know exactly "The Fear Prayer.")

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ، حَدَّثَنَا مَالِكٌ، عَنْ نَافِعٍ، أَنَّ عَبْدَ اللَّهِ بْنَ عُمَرَ ـ رضى الله عنهما ـ كَانَ إِذَا سُئِلَ عَنْ صَلاَةِ الْخَوْفِ قَالَ يَتَقَدَّمُ الإِمَامُ وَطَائِفَةٌ مِنَ النَّاسِ فَيُصَلِّي بِهِمِ الإِمَامُ رَكْعَةً، وَتَكُونُ طَائِفَةٌ مِنْهُمْ بَيْنَهُمْ وَبَيْنَ الْعَدُوِّ لَمْ يُصَلُّوا، فَإِذَا صَلَّوُا الَّذِينَ مَعَهُ رَكْعَةً اسْتَأْخَرُوا مَكَانَ الَّذِينَ لَمْ يُصَلُّوا وَلاَ يُسَلِّمُونَ، وَيَتَقَدَّمُ الَّذِينَ لَمْ يُصَلُّوا فَيُصَلُّونَ مَعَهُ رَكْعَةً، ثُمَّ يَنْصَرِفُ الإِمَامُ وَقَدْ صَلَّى رَكْعَتَيْنِ، فَيَقُومُ كُلُّ وَاحِدٍ مِنَ الطَّائِفَتَيْنِ فَيُصَلُّونَ لأَنْفُسِهِمْ رَكْعَةً بَعْدَ أَنْ يَنْصَرِفَ الإِمَامُ، فَيَكُونُ كُلُّ وَاحِدٍ مِنَ الطَّائِفَتَيْنِ قَدْ صَلَّى رَكْعَتَيْنِ، فَإِنْ كَانَ خَوْفٌ هُوَ أَشَدَّ مِنْ ذَلِكَ صَلَّوْا رِجَالاً، قِيَامًا عَلَى أَقْدَامِهِمْ، أَوْ رُكْبَانًا مُسْتَقْبِلِي الْقِبْلَةِ أَوْ غَيْرَ مُسْتَقْبِلِيهَا‏.‏ قَالَ مَالِكٌ قَالَ نَافِعٌ لاَ أُرَى عَبْدَ اللَّهِ بْنَ عُمَرَ ذَكَرَ ذَلِكَ إِلاَّ عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم‏.‏

sunnah.com