Is it obligatory to restart the prayer if the Imam knew he was in a state of major or minor impurity during the prayer, or if the congregation knew?
Chapter on Praying with Impurity and Other Matters
Al-Mughni
Book of Prayer
Primary text
If the Imam becomes aware during the prayer that he was in a state of impurity, or if the followers (Ma'mumun) become aware of it, they must restart the prayer. Imam Ahmad preferred that the Imam stops, speaks, and then the followers restart their prayer. This ruling is established because the followers imitated an Imam whose prayer was invalid, similar to imitating a woman in prayer, provided there was knowledge from either the Imam or the followers. If this knowledge occurs during the prayer, it necessitates restarting the prayer for all, unlike when ignorance persists among the followers, which would cause undue hardship due to their dispersal.
Supporting text
Ibn Aqil mentioned another narration from Ahmad where the followers may build upon their prayer if they become aware of the Imam's impurity.