The Rules of Forgetfulness (Sahw) in Prayer
Man Lā Yaḥḍuruh al-Faqīh|Volume 1|Book 1|Chapter 50
وَ سَأَلَ أَبُو كَهْمَسٍ أَبَا عَبْدِ اَللَّهِ عَلَيْهِ اَلسَّلاَمُ: عَنِ اَلرَّكْعَتَيْنِ اَلْأُولَيَيْنِ فَإِذَا جَلَسْتُ فِيهِمَا لِلتَّشَهُّدِ فَقُلْتُ وَ أَنَا جَالِسٌ اَلسَّلاَمُ عَلَيْكَ أَيُّهَا اَلنَّبِيُّ وَ رَحْمَةُ اَللَّهِ وَ بَرَكَاتُهُ اِنْصِرَافٌ هُوَقَالَ «لاَ وَ لَكِنْ إِذَا قُلْتَ اَلسَّلاَمُ عَلَيْنَا وَ عَلَى عِبَادِ اَللَّهِ اَلصَّالِحِينَ فَهُوَ اِنْصِرَافٌ.
Abu Kahmas asked Imam Jafar ibn Muhammad Al-Sadiq عليه السلام about the two rak'ahs of prayer when, after sitting in the tashahhud position, he says: "As-Salamu Alayka Ayyuha An-Nabi wa Rahmatullahi wa Barakatuh" (Peace be upon you, O’ Prophet, and the mercy of Allah سبحانه وتعالى and His blessings). Is this considered the ending (of the prayer)? Imam عليه السلام replied: "No, it is not the ending. But when you say 'As-Salamu Alayna wa Ala Ibadillah As-Saliheen' (Peace be upon us and upon the righteous servants of Allah سبحانه وتعالى), that is the ending."
- Ṣaḥīḥ al-Faqīh