Abu Salama b. 'Abd al-Rahman reported that Jabir told him that he had observed the prayer in danger with the Messenger of Allah (ﷺ). The Messenger of Allah (ﷺ) (first) led one of the two groups in two rak'ah of prayer. and then led the second group in two rak'ah of prayer. So the Messenger of Allah (ﷺ) observed four rak'ah and led in two rak'ah each of the groups.