All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
The prayer is the greatest pillar of Islam after the two declarations of faith. Abandoning the prayers according to many scholars takes the person out of the fold of Islam as per Fataawa 84390 and 87319. Some people imagine that there are no benefits in performing the prayers while persisting in committing some sins, and think that a sinner could not establish the prayers. This imagination is wrong and it is just the lure of the devil to mislead human beings. As long as a person prays, he is considered a Muslim even if he persists in committing sins. Whoever dies while having committed sins, if Allaah wills to forgive him, He will forgive him, and if Allaah wills to punish him, He will punish him for the sins that he committed and then He will bring him out of the Hellfire because of his belief and because of the intercession of righteous people of his family. As regards a person who dies as a disbeliever [as a non-Muslim], then there is no way for him to be forgiven by Allaah, Allaah Says (which means): {God does not forgive (the sin of) joining other gods with Him; but He forgives whom He pleases other sins than this.}[Quran 4:116]. Allaah further Says (which means): {Indeed, those who disbelieve and die while they are disbelievers, never would the [whole] capacity of the earth in gold be accepted from one of them if he would [seek to] ransom himself with it. For those there will be a painful punishment, and they will have no helpers.}[Quran 3:91]. Therefore, whoever dies while having performed the prayers is a Muslim even if he had committed sins, and he is better than the one who dies while having abandoned the prayers.
In addition to this, the prayers are a means of having many sins wiped out. A person who is sinful but performs the prayer, his prayers will wipe out many of his sins. The Prophet said: "If there was a river at the door of anyone of you and he took a bath in it five times a day, would you notice any dirt on him?" They [the companions] said, "Not a trace of dirt would be left." The Prophet then said: "That is the example of the five prayers with which Allaah wipes out evil deeds." [Al-Bukhari and Muslim] Besides, the Prophet said: "There is no Muslim who purifies himself as Allaah prescribed him to do, and performs these five daily prayers except that Allaah wipes out the sins that he had committed between them." [Muslim]
Hence, the prayers wipe out the sins, so how come that a person says: 'How can I perform the prayers while I am sinful?'
Allaah Knows best.