Praise be to Allah.
In the case of the obligatory prayer, it is obligatory for you to offer it in the mosque in congregation, if the mosque is nearby. So you should respond to the muezzin when he says “Come to prayer,” and head for the house of Allaah. With regard to praying behind an evildoer, the most correct view is that it is valid to pray behind him even though he appears to be an evildoer. The evidence for that is as follows:
1 – The general applicability of the hadeeth of the Prophet (peace and blessings of Allaah be upon him): “The people should be led in prayer by the one who is most versed in the Book of Allaah…” (Saheeh Muslim, al-Masaajid wa Mawaa’id al-Salaah, 673)
2 – The Sahaabah (may Allaah be pleased with them) used to pray behind al-Hajjaaj, and al-Hajjaaj was known to be an evildoer.
3 – From a logical point of view, everyone whose prayer is valid is acceptable as a imaam to lead the prayers. There is no evidence to suggest differentiating between the validity of a person’s prayer and the validity of a person’s leading the prayer.
al-Sharh al-Mumti’ by Ibn ‘Uthaymeen, 4/307
There is another view: some of the fuqahaa’ say that prayer offered behind an evildoer is not valid, but those who say this do not have any sound evidence to support this view.
No doubt it is better for you to lead the prayer instead of your brother, especially if you meet the conditions for being better qualified to lead the prayer as specified in the hadeeth: “The people should be led in prayer by the one who is most versed in the Book of Allaah. If they are equally versed in the 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 …” (Narrated by Muslim). The same applies if you are righteous, for the prayer of the righteous is more perfect, more focused and more in accordance with the Sunnah.
The Standing Committee was asked about a man who was haafiz (i.e., he had memorized the entire Qur’aan) but he did not have a beard, and another who had memorized less Qur’aan but he had a beard. They replied that the one who had a beard, even though he had memorized less Qur’aan, should be given priority over the one who shaved his beard, even though he had memorized the whole Qur’aan.
See Fataawa al-Lajnah al-Daa’imah, 7/375, and similar fatwas.
And Allaah knows best.