Bulugh al-Maram
Book 2, Hadith 401
وَعَنِ ابْنِ عُمَرَ قَالَ: { غَزَوْتُ مَعَ اَلنَّبِيِّ - صلى الله عليه وسلم -قِبَلَ نَجْدٍ, فَوَازَيْنَا اَلْعَدُوَّ, فَصَافَفْنَاهُمْ, فَقَامَ رَسُولُ اَللَّهِ - صلى الله عليه وسلم -يُصَلِّي بِنَا, فَقَامَتْ طَائِفَةٌ مَعَهُ, وَأَقْبَلَتْ طَائِفَةٌ عَلَى اَلْعَدُوِّ, وَرَكَعَ بِمَنْ مَعَهُ, وَسَجَدَ سَجْدَتَيْنِ, ثُمَّ انْصَرَفُوا مَكَانَ اَلطَّائِفَةِ الَّتِي لَمْ تُصَلِّ فَجَاءُوا, فَرَكَعَ بِهِمْ رَكْعَةً, وَسَجَدَ سَجْدَتَيْنِ, ثُمَّ سَلَّمَ, فَقَامَ كُلُّ وَاحِدٍ مِنْهُمْ, فَرَكَعَ لِنَفْسِهِ رَكْعَةً, وَسَجَدَ سَجْدَتَيْنِ } مُتَّفَقٌ عَلَيْهِ، وَهَذَا لَفْظُ اَلْبُخَارِيِّ 1 .1 - صحيح. رواه البخاري (942)، ومسلم (839).
Ibn Umar reported: I went on an expedition with the Prophet ﷺ toward Najd. We faced the enemy and formed ranks. The Messenger of Allah ﷺ stood to lead us in prayer. One group stood with him while another faced the enemy. He bowed with those behind him and prostrated twice, then they withdrew to take the place of the group that had not prayed. That group came forward, and he bowed and prostrated twice with them. Then he said the closing salutation with them. Each group then stood and completed one rakah and two prostrations on its own. Agreed upon; this is the wording of al-Bukhari. Al-Bukhari (942) and Muslim (839).
Translation notes
This is one described form of the fear prayer, with the groups taking turns behind the Prophet ﷺ while the other group guarded against the enemy.