Assalamu’alaikum warahmatullahi wabarakatuh,
IN THE NAME OF ALLAH, THE MOST BENEFICENT, THE MOST MERCIFUL
This is the issue of praying behind a rebellious sinner (faasiq). The faasiq is one who disobeys Allah by committing one of the major sins (kabeerah) or persisting in committing a minor sin (sagheerah). According to what was said in your question, you are committing some major sins, namely working in a bank and shaving your beard. These are two major sins according to the standards of sharee’ah. With regard to praying behind one whose sin is obvious, the scholars differed concerning this issue, and there are two opinions.
The first view is that it is not correct to pray behind a faasiq (rebellious sinner).
This is the view of Ahmad and Maalik, in one of the two reports narrated from them.
Shaykh Mustafa al-Ruhaybaani said: (Section) (It is not correct to pray behind a faasiq at all): i.e., whether his fisq (sin, rebellion) has to do with his beliefs or his doing a haraam action, even if it is concealed, because Allah says (interpretation of the meaning):
“Is then he who is a believer like him who is a Faasiq (disbeliever and disobedient to Allah)? [al-Sajdah 32:18]
Mataalib Ooli al-Nuha, 1/653
Shaykh al-Islam [Ibn Taymiyah] (may Allah have mercy on him) said:
The imaams are agreed that it is disliked (makrooh) to pray behind a Faasiq, but they differed as to whether the prayer is valid. Some said that it is not valid, such as Maalik and Ahmad according to one of the two reports narrated from them. Some said that it is valid, such as Abu Haneefah, al-Shaafa’i, and the other report from [Malik and Ahmad]. But they did not dispute concerning the fact that such a one should not be appointed [to lead the prayer].
Majmoo’ al-Fataawa, 23/358
The second opinion, that prayer behind a faasiq is valid, even if his sin is obvious, is the correct view and it is the view favoured by Shaykh Muhammad ibn ‘Uthaymeen (may Allah have mercy on him). The evidence for this view is as follows:
1 – The general meaning of the hadeeth of the Prophet (peace and blessings of Allah be upon him): “The people should be led in prayer by the one among them who has most knowlegde of the Book of Allah.” (Narrated by Muslim, 673).
2 – The specific meaning of the words of the Prophet (peace and blessings of Allah be upon him) concerning oppressive leaders who lead the prayer at the wrong time: “Pray the prayer on time, then if you come to them at the time when they are praying, pray with them, and it will be a naafil prayer for you.” (Narrated by Muslim, 648). And al-Bukhaari narrated: “If the imaam leads the prayer correctly, then he and you will receive the rewards, but if he makes a mistake (in the prayer) then you will receive the reward for the prayer and the sin (will be his).” (Narrated by al-Bukhaari, 694).
3 – The Sahaabah, including Ibn ‘Umar, used to pray behind al-Hajjaaj, and Ibn ‘Umar was one of the keenest of people to follow the Sunnah and pay attention to it, and al-Hajjaaj was known to be one of the most rebellious and sinful of the slaves of Allah.
It might also be said that everyone whose prayer is valid, it is also valid for him to lead the prayer. There is no evidence to suggest that we should differentiate between the validity of the prayer and the validity of leading the prayer, because if a person commits a sin, he does so for himself, but this is merely theoretical. See al-Sharh al-Mumti’ by Ibn ‘Uthaymeen, 4/304).
You should note that the reward for leading the prayers is very great and it is a great honour. The Prophet (peace and blessings of Allah be upon him) said that the one who has more knowledge of Qur’aan (i.e., the one who has memorized more) is the one who should be given precedence in leading the prayer. Therefore if someone else knows more Qur’aan than you do, he should be given precedence. If there is no one other than yourself, then it is o.k. for you to lead the others in prayer, even if you are a sinner for the reasons explained above.
Finally, we advise you to fear Allah and to avoid waging war against Him by sinning. Hasten to repent to Allah before death comes to you and you regret it at the time when regret will not avail you anything.
Allah Knows Best