The Book of Leading the Prayer (Al-Imamah)
كتاب الإمامة
Read the English translation first, with the original Arabic directly underneath.
The obligation of prayer is removed from one who offered it in the masjid with the Imam in congregation
It was narrated from Anas bin Malik that the Messenger of Allah (ﷺ) rode a horse and fell from it, and sustained an injury on his right side. He led one of the prayers sitting, and we prayed behind him sitting. When he had finished he said:
"The Imam is appointed to be followed. If he prays standing then pray standing; when he bows, bow; when he says, Sami' Allahu liman hamidah (Allah hears those who praise Him), say 'Rabbana lakalhamd (Our Lord, to You be praise); and if he prays sitting then pray sitting, all of you."
إِنَّمَا جُعِلَ الإِمَامُ لِيُؤْتَمَّ بِهِ فَإِذَا صَلَّى قَائِمًا فَصَلُّوا قِيَامًا وَإِذَا رَكَعَ فَارْكَعُوا وَإِذَا قَالَ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقُولُوا رَبَّنَا لَكَ الْحَمْدُ وَإِذَا صَلَّى جَالِسًا فَصَلُّوا جُلُوسًا أَجْمَعُونَ