The Messenger of Allah ﷺ led the prayer of fear on one of his days. One group stood with him while another faced the enemy. He prayed one rakah with those who were with him, then they left and the others came, and he prayed one rakah with them. Then each of the two groups completed the remaining rakah on their own.
أخبرنا عبد الأعلى بن واصل بن عبد الأعلى قال حدثنا يحيى بن آدم عن سفيان عن موسى بن عقبة عن نافع
صلى رسول الله ﷺ صلاة الخوف في بعض أيامه فقامت طائفة معه وطائفة بإزاء العدو فصلى بالذين معه ركعة ثم ذهبوا وجاء الآخرون فصلى بهم ركعة ثم قضت الطائفتان ركعة ركعة
[Sahih] Muslim narrated it in "Prayer of the Traveler," chapter "Prayer of Fear," hadith no. 306/839, from the hadith of Yahya bin Adam through his line of transmission, and it is also in Kubra, hadith no. 1930.