Sunan an-Nasa'i, Volume 2, Book 18, Hadith 1543 (DarusSalam)

It was narrated that Ibn 'Umar said: "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."

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

sunnah.com