Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) said that the Messenger of Allah (peace and blessings be upon him) led his Companions in two rak'ahs and then gave the salam; then he (peace and blessings be upon him) led the other group in two rak'ahs and then likewise gave the salam.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب صلاة الخوف / 6035