All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
If the imam leads the people in prayer while he is not in a state of ablution and the congregation does not know about his situation, then they are not required to repeat the prayer; it is only the imam who is required to repeat it. This is the view of the majority of the scholars, and it is the view reported from the three caliphs: ‘Umar, ‘Uthman and ‘Ali, may Allah be pleased with them. It was also narrated from ‘Ali that they should repeat the prayer like the imam, but this narration is not proven to be authentic.
Ibn Qudaamah, may Allah be pleased with them, said:
“In brief, if the imam leads the people in prayer while he is Muhdith (not in a state of ablution) or Junub (in a state of major ritual impurity, like after having had sexual relations, for example) and neither he nor the congregation knew about it until they finished the prayer, then their prayer is valid while the prayer of the imam is invalid. This was reported from ‘Umar, ‘Uthman, ‘Ali, and Ibn ‘Umar, may Allah be pleased with them. The same view was held by Al-Hasan, Sa‘eed ibn Jubayr, Maalik, Al-Awzaa‘i, Ash-Shaafi‘i, Sulaymaan ibn Harb, and Abu Thawr.
There is another view from ‘Ali that the imam is required to repeat the prayer and that the people whom he led in congregation are also required to repeat it. Ibn Sireen, Ash-Sha‘bi, and Abu Haneefah and his companions said the same thing; because he led them in prayer while he was not in a state of ablution, so it is as if he knew about it... We have the consensus of the Companions, may Allah be pleased with them, as evidence ... and the second view that was reported from ‘Ali was not proven…”
As regards your question about the evidence of the Hanafi School for their view on repeating the prayer, then among their evidence is the hadith which reads, “Whoever leads people in prayer and it then turns out that he was Muhdith or Junub, he repeats and they repeat.” This hadith was cited by Az-Zayla‘i in Nasb Ar-Raayah, and then he said, “It is not known.” The Hanafi scholar Badr Ad-Deen Al-‘Ayni also mentioned it in Al-Binaayah Sharh Al-Hidaayah, and he then said, “It is not known.” Ibn Hajar said about it in Ad-Diraayah, “I did not find it attributed to the Prophet .”
They also used as evidence what Ad-Daaraqutni reported from ‘Ali, that he led the people in prayer while he was Junub, and so he repeated the prayer and ordered them, and they repeated also it.” Ibn Hajar said, “Its chain of narrators is weak.”
As for the statement of ‘Ali which you referred to in the question, then perhaps you mean what was reported by Ad-Daaraqutni from ‘Abbaad ibn Katheer, from ‘Amr ibn Khaalid, from Habeeb ibn Abi Thaabit, from ‘Aasim ibn Abi Dhamrah, from ‘Ali, that he led the people in prayer while he was Junub and then ordered Ibn An-Nabbaah to announce: “Whoever prayed the morning prayer with the Commander of the Believers, then let him repeat his prayer, as he led the people in prayer while he was Junub.”
The narrations of ‘Abbaad ibn Katheer are rejected, and his Shaykh in the chain of narrators is ‘Amr ibn Khaalid Al-Waasiti, who is also rejected [i.e. his narrations are left out], and Ibn Ma‘een said about him that he is a liar. Imam Ahmad said about him, “His hadith is rejected, and he is nothing.” The chain of narrators also includes Habeeb ibn Abi Thaabit, who is a Mudallis (he narrates what he did not hear directly).
Allah knows best.