The Prophet ﷺ prayed in time of danger and divided them (the people) behind him in two rows. He then led those who were near him in one rak'ah. Then he stood and remained standing till those who were in second row offered one rak'ah. Thereafter they came forward and those who were in front of them (in the first row) stepped backward. The Prophet ﷺ led them in one rak'ah of prayer. He sat down till those who were in the second row completed on rak'ah. He then uttered the salutation. (Using translation from Abū Dāʾūd 1237)
أَنَّ النَّبِيَّ ﷺ صَلَّى بِأَصْحَابِهِ فِي خَوْفٍ فَجَعَلَهُمْ خَلْفَهُ صَفَّينِ فَصَلَّى بِالَّذِينَ يَلُونَهُ رَكْعَةً ثُمَّ قَامَ فَلَمْ يَزَلْ قَائِمًا حَتَّى صَلَّى الَّذِينَ خَلْفَهُ رَكْعَةً ثُمَّ تَقَدَّمُوا وَتَأَخَّرَ الَّذِينَ كَانُوا قُدَّامَهُمْ فَصَلَّى بِهِمُ النَّبِيُّ ﷺ رَكْعَةً ثُمَّ قَعَدَ حَتَّى صَلَّى الَّذِينَ تَخَلَّفُوا رَكْعَةً ثُمَّ سَلَّمَ بِهِمْ