The final tashahhud is one of the pillars or essential parts of the prayer, and it must be completed in full, because Ibn Mas’ood (may Allaah be pleased with him) said: Before the tashahhud was enjoined upon us, we used to say, ‘Peace be upon Allaah before His creation, peace be upon Jibra’eel and Mikaa’eel.’ Then the Messenger of Allaah (peace and blessings of Allaah be upon him) taught us the tashahhud. Narrated by al-Nasaa’i (1277), al-Daaraqutni and al-Bayhaqi; classed as saheeh by al-Haafiz ibn Hajar in al-Fath (2/312) and by al-Albaani in Irwa’ al-Ghaleel (319).
The phrase “before the tashahhud was enjoined upon us” clearly indicates that the tashahhud is obligatory.
See: al-Sharh al-Mumti’ (3/422).
Hence if the imam says the salaam before the person praying behind him has completed it, then he should not follow him, rather he should complete his tashahhud first.
It says in Kashshaaf al-Qinaa’ (1/565):
If the Imam finishes his recitation before the one who is praying behind him and bows, then the one who is praying behind him should follow him, and stop his own recitation, because in his case reciting is mustahabb, but following the imam is obligatory, and there is no conflict between what is obligatory and what is mustahabb, unlike the tashahhud where, if the imam finishes before the one who is praying behind him, the latter should not follow him, rather he should complete the tashahhud when the imam says the salaam, then say salaam, because of the general meaning of the command to recite the tashahhud.
With regard to the sending of blessings upon the Prophet (peace and blessings of Allaah be upon him), in the answer to question no. 39676 we have stated that there is a difference of opinion among the scholars concerning that. Some of them say that it is a pillar or essential part of the prayer, and others say that it is Sunnah and mustahabb.
The Prophet (peace and blessings of Allaah be upon him) enjoined the one who has completed the final tashahhud to seek refuge with Allaah from four things. He said: “When one of you finishes reciting the final tashahhud, let him seek refuge with Allaah from four things: from the punishment of Hell, from the punishment of the grave, from the trials of life and death, and from the evil of the Dajjaal.” Narrated by Muslim (588).
Some of the scholars are of the view that reciting this du’aa’ is obligatory.
Based on this, then in order to be on the safe side, the person who is praying behind an imam should not say the salaam until he has completed the tashahhud and sent blessings upon the Prophet (peace and blessings of Allaah be upon him), and sought refuge with Allaah from these four things.
Shaykh Ibn Baaz (may Allaah have mercy on him) was asked: During the prayer, the imam said the salaam and I had only completed a small part of al-tahiyyaat. Should I repeat my prayer?
He replied: You have to complete the tashahhud even if it means that you are a little behind your imam, because the final tashahhud is a pillar or essential part of the prayer according to the more correct of the two scholarly opinions, and it includes sending blessings upon the Prophet (peace and blessings of Allaah be upon him).
So what you have to do is complete it, even if that is after the imam says the salaam. It also includes seeking refuge with Allaah from the punishment of Hell, the torment of the grave, the trials of life and death and the trial of the Dajjaal, because the Prophet (peace and blessings of Allaah be upon him) enjoined seeking refuge from these four things in the final tashahhud, and because some of the scholars said that this is obligatory. And Allaah knows best. End quote.
Majmoo’ Fataawa Ibn Baaz (11/248).