Hadith 617
Narrated Abdullah ibn Amr ibn al-As: The Prophet ﷺ said: When the Imam completes the prayer and sits (for reciting tashahhud), and then becomes defiled (i. e. his ablution becomes void) before he speaks (to someone), his prayer becomes complete. And those who prayed behind him also complete the prayer.
Hadith 618
Narrated Ali ibn Abu Talib: The Prophet ﷺ said: The key of prayer is purification; takbir (saying "Allah is most great") makes (all acts which break prayer) unlawful and taslim (uttering the salutation) makes (all such acts) lawful.