Imam nullifies his ablution during prayer
Question

What happens if the Imam nullifies his ablution during the prayer? Or what if he suddenly recalls that he in fact was not in a state of wudu in the first place? What should he do? Is the prayer of the people praying behind him still valid or do they need to make up all or part of it?
Praise be to Allah. 
If the Imam enters the state that nullifies his ablution or prayer, or remembers during the prayer that he did not perform ablution, then he should come out from prayer and appoint someone from the attendees who can lead them to completion. This has been narrated from ‘Umar, ‘Ali, ‘Alqamah and ‘Ataa’. If he did not appoint anyone and the people prayed individually, this would be acceptable, and this is the opinion taken by Imam Al-Shafi‘i. If he elected someone and advanced him to lead them, that is also permitted. The evidence for this is what has been narrated regarding ‘Umar (may Allah be pleased with him) when he was stabbed. He took Abdur Rahman bin ‘Auf who led the prayer to completion.
1
 
And the reason for this deduction is that ‘Umar did so in the presence of a number of Companions and others and no one opposed this act, so it became a consensus (ijma‘).
2
If the Imam remembers that he is not in a state of purity, he should indicate to the followers to remain as they are and purify himself and come back to lead them. The evidence for this is the following narration of Abu Dawud from Abu Bakrah:

The Prophet (sallallaahu ‘alayhi wa sallam) entered into the Fajr prayer and indicated to the people that they should stay in their places. Then he came back to lead them and water was dripping from his head.

  (Sunan Abi Dawud, No. 233; Sahih Sunan Abi Dawud, 1/45)
 Commenting on this hadith, Imam Al-Khatabi says:
 
 In this hadith there is an evidence that if one is leading the people in prayer while in a state of impurity and the people do no know of it, then their prayer is unaffected and there is no need for them to repeat it. But the Imam has to repeat his prayer.
3
 
If one is praying (either as Imam or follower or individually) and recalls that he had wiped over his socks during wudu while the duration of wiping had expired, he should terminate his prayer because his ablution is incorrect. This is what has been quoted from Imams Ahmad and Al-Shafi‘i.
4
Sahih Al-Bukhari/Fath Al-Bari, 7/60.
 
 
2 Ahkam Al-Imamah by Al-Muneef, 234, 1st Edition.
 
 
3 Ma‘alim As-Sunan by Al-Khatabi (Collected by Al-Da‘as) 1/159.
 
 
4 Al-Mughni, 2/505.