I contemplated the statement of Allah,
يَمُنُّونَ عَلَيْكَ أَنْ أَسْلَمُوا۟ ۖ قُل لَّا تَمُنُّوا۟ عَلَىَّ إِسْلَـٰمَكُم ۖ بَلِ ٱللَّهُ يَمُنُّ عَلَيْكُمْ أَنْ هَدَىٰكُمْ لِلْإِيمَـٰنِ إِن كُنتُمْ صَـٰدِقِينَ
“They consider it a favour to you that they have accepted Islam. Say, ‘Do not consider your Islam a favour to me. Rather, Allah has conferred favour upon you that He has guided you to the faith, if you should be truthful.” [Qur’an 49:17]
and I came to realise an awe-inspiring meaning. ‘That is; when these people were granted the sense of intellect, they employed it to ascertain the flaws of idols causing them to conclude that such idols are unsuitable to be worshipped, thus directed their worship to the One who created all things. This knowledge is nothing but the fruits of the intellect that Allah bestowed upon them, with which they could distinguish themselves from beasts.
However, when they thought that they believed in Allah because of what their granted intellect directed them to, they failed to realise the supremacy of the Granter, and also overlooked what He granted them. How could they claim the ownership of the fruit when the tree is not even theirs? Every indulgent worshipper and seeker of knowledge can only reach what they are upon after seeing the light of awakening, and distinguish the truth using the power of understanding and sound reasoning. Hence, they should express their gratitude and appreciation to the One who granted them the torch in the midst of the darkness they were in.
Relevant to this point is the case of the three men who were trapped in the cave after a boulder blocked its entrance. Each one of them invoked Allah with one good deed they had done. If they actually noticed the grace of the Granter (i.e. Allah) when He safeguarded them from the sins they were about to commit, and hence invoked Him with what He bestowed upon them because they felt privileged for being granted what others did not have, then they actually invoked Allah through Allah Himself.
On the other hand, if they were focused on their actual good deeds thinking the reward they received is because they are the ones who performed these good deeds, then they would have become from the heedless who do not observe their Lord in all their actions.
The answer to their prayers in such case will therefore be their continuous showing favour to Allah for what they did, come to an end.
The same applies to the one whose piety and righteousness is what he thinks of himself, thus proud of. Therefore, he considers himself better than most people and looks down on sinners and becomes arrogant with them. This is indeed a deviation from the right path towards achieving the right attitude and behaviour to earn the pleasure of Allah, which may be the cause to take the person completely off the track.
Beware! Let none of you misunderstand my words, as I do not advise the pious of you to socialise with sinners to prove you are humbling yourself.
Rather, be angry for the sins they commit in your heart, refuse to be with them, and then contemplate the effect of the plan of fate on them for most of them do not even realise the One whom they disobeyed.
The majority of sinners do not purposely intend to disobey Allah but rather they just want to follow their desires while, in their heart, disobeying their Lord is something they find hard to do.
Some of them are furthermore attached to the divine Attributes of His Forgiveness and Forbearance, so tend to overlook the sins they commit due to their strong belief that Allah will forgive them. None of these are valid excuses, but the pious should keep this in mind to try and understand that he has more responsibility than them, because the proof is fully established in him since he knows his Lord and realises his sins.
Think of how Allah turns the hearts of His servants between His fingers, and remember that the trial may one-day effect you; causing you to deviate from the right path and the sinner to return to the right path.
I wonder at those who show Allah favour for their good deeds while forgetting the One who guided them and facilitated these deeds for them.
[Captured Thoughts by Ibn Jawzi, p. 291-293]