[Machine] Ibn Abbas said about the saying of Allah, "And when you are among them and lead the prayer for them, let a group of them stand [in prayer] with you." (Quran 4:102), that this prayer is performed during times of fear. The Imam stands and a group of them stands with him, and another group takes their weapons and stands facing the enemy. Then the Imam prays one rak'ah with those who are with him, and then sits in his posture while they stand and pray the second rak'ah individually for themselves. The Imam remains seated until they join their companions and stand in their positions, and then others come forward and the Imam prays the second rak'ah for them. This is how the Messenger of Allah ﷺ prayed with the people on the day of the Nakhla palm tree.
عَنِ ابْنِ عَبَّاسٍ فِي قَوْلِهِ {وَإِذَا كُنْتَ فِيهِمْ فَأَقَمْتَ لَهُمُ الصَّلَاةَ فَلْتَقُمْ طَائِفَةٌ مِنْهُمْ مَعَكَ} فَهَذَا الصَّلَاةُ عِنْدَ الْخَوْفِ يَقُومُ الْإِمَامُ وَيَقُومُ مَعَهُ طَائِفَةٌ مِنْهُمْ وَطَائِفَةٌ يَأْخُذُونَ أَسْلِحَتَهُمْ وَيَقِفُونَ بِإِزَاءِ الْعَدُوِّ فَيُصَلِّي الْإِمَامُ بِمَنْ مَعَهُ رَكْعَةً ثُمَّ يَجْلِسُ عَلَى هَيْئَتِهِ فَيَقُومُونَ فَيُصَلُّونَ لِأَنْفُسِهِمُ الرَّكْعَةَ الثَّانِيَةَ وَالْإِمَامُ جَالِسٌ ثُمَّ يَنْصَرِفُونَ حَتَّى يَأْتُوا أَصْحَابَهُمْ فَيَقِفُونَ مَوْقِفَهُمْ ثُمَّ يُقْبِلُ الْآخَرُونَ فَيُصَلِّي لَهُمُ الْإِمَامُ الرَّكْعَةَ الثَّانِيَةَ فَهَكَذَا «صَلَّى رَسُولُ اللهِ ﷺ بِالنَّاسِ يَوْمَ بَطْنِ نَخْلَةَ»