It was narrated that Abu Hurayrah (may Allaah be pleased with him) said: the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “The imaam is appointed to be followed. When he says ‘Allaahu akbar’, then say ‘Allaahu akbar’, do not say it until he has said it. When he bows in rukoo’, then bow in rukoo’, and do not do it until he has done it. When he says ‘Sami’a Allaahu liman hamidah,’ then say, ‘Allaahumma Rabbanaa laka al-hamd.’ When he prostrates, then prostrate, and do not do it until he has done it. If he prays standing then pray standing, and if he prays sitting, then pray sitting, all of you.” (This version narrated by Abu Dawood; similar reports are also narrated in al-Saheehayn).
What we learn from this hadeeth is that it is obligatory to follow the imaam, and that he is the leader in the movements, actions and words of the prayer. It is not permissible to differ from him. The best is for the follower’s movements to come immediately after the imaam’s movements, and not to delay them … This immediate following is indicated (in the original Arabic of the hadeeth) by the particle fa (then), which implies sequence.
We also learn from this hadeeth that anticipating or preceding the imaam is forbidden, and if it is done deliberately, it invalidates the prayer. Delaying following him, like preceding him, is not allowed.
The phrase “the imaam is appointed to be followed” means that the one who is following should not precede the one whom he is following or move at the same time as him; his movements should come straight after the imaam’s movements. And Allaah knows best.