It is important to choose as the imam one who is known for righteousness, decency and keenness to benefit the people, because the post of imam is a noble post and the one who does this task is acting in the stead of the Prophets, caliphs and scholars. The Prophet (blessings and peace of Allaah be upon him) said: “The people should be led by the one who has most knowledge of the Book of Allaah. If they are equal in knowledge of Qur’aan, then by the one who has most knowledge of the Sunnah. If they are equal in knowledge of the Sunnah, then by the one who migrated first. If they are equal in terms of migration, then by the one who entered Islam first”
Narrated by Muslim (673).
So the Prophet (blessings and peace of Allaah be upon him) chose for the position of imam the best and most perfect.
If the imam has the shortcomings or faults that you have mentioned, then he should not have been appointed as an Imam in the first place and he should be dismissed from the post so long as that will not lead to greater mischief.
Abu Dawood (481) narrated that a man led some people in prayer and spat in the direction of the qiblah whilst the Messenger of Allaah (blessings and peace of Allaah be upon him) was looking on. When he had finished, the Messenger of Allaah (blessings and peace of Allaah be upon him) said: “He should not lead you in prayer.” After that, he wanted to lead them in prayer but they stopped him and told him what the Messenger of Allaah (blessings and peace of Allaah be upon him) hadsaid. He mentioned that to the Messenger of Allaah (blessings and peace of Allaah be upon him) and he said “Yes”, and I (the narrator) think he said: “You offended Allaah and His Messenger.”
the hadeeth was classed as hasan by al-Albaani in Saheeh Abi Dawood.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: the imams are agreed that it is makrooh to pray behind an evildoer, but they differed as to whether (such a prayer) is valid. It was said that it is 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 the other view narrated from (Ahmad and Maalik). But they did not differ concerning the fact that it is not appropriate to appoint him (as an imam). End quote from Majmoo’ al-Fataawa (23/358).
Shaykh Ibn Baaz (may Allaah have mercy on him) said: If it is possible not to appoint one who commits evil openly as an imam, then one must avoid that. But if someone else appoints him and he cannot dismiss him from this post of imam or it is not possible to dismiss him from the post of imam except by means of an evil that will cause greater harm than the harm of the evil that he commits openly, then it is not permissible to ward off a lesser evil by means of a greater evil or to ward off a lesser harm by means of a greater harm. Islam came to achieve and complete interests and to ward off and reduce evil as much as possible. End quote from Majmoo’ Fataawa al-Shaykh Ibn Baaz (9/377).
With regard to prayer offered behind him, it is valid even if he is an evildoer, according to the more correct of the two scholarly opinions. See the answer to question number 13465.
But if what is said about him is proven, that he does witchcraft, then in this case it is not permissible to make him an imam or to pray behind him.
To sum up: advice should be offered to such a person first of all, and he should be reminded that he is an example for others and that things may be regarded as bad on his part that are not regarded as such on the part of others, and that he has to avoid all causes of suspicion, and strive to do his work and fulfil the trust that has been given to him.
The committee that is in charge of the mosque has to dismiss him from the post of imam so long as they are able to do that, and appoint someone who is more suited to this post than him, and is less likely to come under suspicion and is more likely to bring people together.
May Allaah help us all to do that which He loves and which pleases Him.
And Allaah knows best.