Sayyiduna Ibn Abbas (may Allah be pleased with them both) said concerning this saying of Allah Almighty: "And when you are among them and lead them in prayer, let a group of them stand with you" [Surah al-Nisa: 102]: This is the prayer in a state of fear. The imam stands, and a group of them stands with him, while the other group holds its weapons and stands facing the enemy. Then the imam leads those with him in one rak'ah, then remains sitting in his position, and they stand up and pray the second rak'ah by themselves while the imam remains sitting. Then they would go back until they came to their companions and stood in their place. Then the other group would come forward and the imam would lead them in the second rak'ah. In this way the Messenger of Allah (peace and blessings be upon him) led the people in prayer on the day of Batn Nakhlah.
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12965