If what the muezzin said about this immoral imam is true, then he is in great danger and there is the fear that he may fall into apostasy or meet a bad end. That is because:
He is taking the house of Allaah as a place for his immoral actions and evil deeds, but Allaah has enjoined that His houses should be venerated and kept pure, and Allaah has established them for prayer, du’aa’ and i’tikaaf. If they are taken as places for immoral actions with women, then this is extremely reprehensible; the hypocrites did not even do that in their mosque, “masjid al-diraar!
Allaah says (interpretation of the meaning):
“In houses (mosques) which Allaah has ordered to be raised (to be cleaned, and to be honoured), in them His Name is remembered [i.e. Adhaan, Iqaamah, Salaah(prayers), invocations, recitation of the Qur’aan]. Therein glorify Him (Allaah) in the mornings and in the afternoons or the evenings”
The “houses” referred to in this verse are the mosques.
Ibn Katheer (may Allaah have mercy on him) said:
Allaah has enjoined that they be raised i.e., cleansed of filth, idle talk and actions, and words that are not befitting therein. Qataadah said: This refers to the mosques which Allaah has commanded should be built, raised, maintained and purified. There are many ahaadeeth about building mosques, venerating them, respecting them, perfuming them and scenting them with incense. End quote.
Tafseer Ibn Katheer (6/62).
The other matter is his boasting of sin and flaunting it. Committing sin in secret whilst fearing Allaah is not like doing it openly, flaunting it and boasting about it.
See the answer to question no. 9562, which includes the warning addressed to the one who commits sin openly and flaunts it.
What you have to do is advise him, and restrain him, and take him to some scholars and elders who can offer him advice and explain to him the seriousness of his actions, because he is an example for others and it is not appropriate for him to do these things. The people are influenced by the imam of their mosque and they look as his actions as the application of what he reads in the Qur’aan; but this advice should be given with kindness and wisdom.
It was narrated from Tameem al-Daari (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: “Religion is sincerity.” We said: To whom? He said: “To Allaah, to His Book, to His Messenger, and to the leaders of the Muslims and their common folk.” Narrated by Muslim (55).
If he responds to this advice and stops the evil deeds that he is doing and stops listening to evil things, then he will have done well, and you will have reward for that. But if he rejects your advice and persists in his evil and deviation, then you must take the next steps:
Address a complaint to the relevant authorities, which should be signed by all the worshippers in the mosque. It is hoped that the authorities will take the appropriate action of warning him or dismissing him from his post.
Prevent him from leading the prayers, if you are able to do that without it resulting in more trouble or arguments among the worshippers. The Prophet (peace and blessings of Allaah be upon him) prevented a man from leading his people in prayer because he led a congregation in prayer and spat in the direction of the qiblah. The Prophet (peace and blessings of Allaah be upon him) said to him: “You have offended Allaah and His Messenger.” Narrated by Abu Dawood (481) and classed as hasan by al-Albaani in Saheeh Abi Dawood.
The evils that your imam has committed are worse than spitting in the direction of the qiblah whilst praying.
If you are not able to do that, then you should refrain from praying behind him in order to denounce him. If there is no other mosque where you can pray, then there is no sin in your praying behind him, and his sin is on himself. Praying behind an evildoer or immoral person is permissible and valid, and it is better than a person praying on his own. It is not permissible to forgo praying Jumu’ah prayer and prayers in congregation on the basis that the imam is an evildoer or immoral person.
Shaykh al-Islam (may Allaah have mercy on him) said:
With regard to praying behind those who follow whims and desires and innovations, and behind immoral people, there is a well known difference of scholarly opinion. But the moderate opinion concerning these people is that appointing one of these people to lead the prayer is not permissible when it is possible to appoint someone else. If he is one who commits immoral actions or innovations openly, then it is obligatory to denounce him and tell him not to do that, and the minimum level of denouncing is shunning him, so that he will give up his immoral actions or bid’ah. Hence the majority of imams differentiated between the daa’iyah and others: if a daa’iyah commits evil openly then he deserves to be denounced for it, unlike the one who keeps quiet, who is like one who commits sin secretly, so he should not be denounced openly, because if the sin is done secretly it does not affect anyone but the one who does it; but if he commits sin openly and is not denounced, then this harms everyone. End quote.
Majmoo’ al-Fataawa (23/342).
And he (may Allaah have mercy on him) said:
The imams are unanimously agreed that it is makrooh to pray behind a faasiq, but they differed as to whether the prayer is valid. It was said that it was not valid, as was the view of Maalik and Ahmad in one of the two reports narrated from them. And it was said that it is valid, as was the view of Abu Haneefah and al-Shaafa’i, and mentioned in the other view from Maalik and Ahmad, but they did not dispute the fact that such a one should not be appointed. End quote.
Majmoo’ al-Fataawa (23/358).
See also the answer to question no. 47884.
This imam should realize that his sin is not like the sin of others, because he has knowledge of the shar’i rulings, and he is leading the people in prayer which is the role of the Prophets, caliphs and scholars. There is a stern warning to imams, that the imam’s prayer will not be accepted if the people praying behind him hate him because of his evildoing or innovation (bid’ah).
It was narrated that Abu Umaamah (may Allaah have mercy on him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “There are three whose prayer goes no further than their ears: the runaway slave, until he returns; a woman whose husband remains angry with her overnight; and the imam who leads people in prayer when they dislike him to lead them.”
Narrated and classed as hasan by al-Tirmidhi (360); also classed as hasan by al-Albaani in Saheeh al-Tirmidhi.
Al-Shawkaani (may Allaah have mercy on him) said:
The apparent meaning of the ahaadeeth which warn the one who leads people in prayer when they dislike him leading them, is that his prayer will not be accepted. End quote.
Al-Sayl al-Jiraar (1/255).
This imam should beware of the consequences of his deeds and sins. We ask Allaah to guide him.
And Allaah knows best.