"The Messenger of Allah ﷺ offered the fear prayer during one of his battles. One group stood with him and another group faced the enemy. He led those who were with him in praying one rak'ah, then they went away and the others came, and he led them in praying one rak'ah. Then each group made up one rak'ah." (Using translation from Nasāʾī 1542)
صَلَّى رَسُولُ اللهِ ﷺ صَلَاةَ الْخَوْفِ فِي بَعْضِ أَيَّامِهِ فَقَامَتْ طَائِفَةٌ مَعَهُ وَطَائِفَةٌ بِإِزَاءِ الْعَدُوِّ فَصَلَّى بِالَّذِينَ مَعَهُ رَكْعَةً ثُمَّ ذَهَبُوا وَجَاءَ الْآخَرُونَ فَصَلَّى بِهِمْ رَكْعَةً ثُمَّ قَضَتِ الطَّائِفَتَانِ رَكْعَةً رَكْعَةً