Thank you for your question and for contacting Ask About Islam.
Regarding this topic, Prophet Muhammad (peace and blessings be upon him) has said:
Actions are (judged) by intentions (niyyah), so each man will have what he intended. Thus, he whose migration (hijrah) was to Allah and His Messenger, his migration is to Allah and His Messenger; but he whose migration was for some worldly thing he might gain, or for a wife he might marry, his migration is to that for which he migrated. (Bukhari, Muslim)
This means that it is not enough that you do good deeds, but you ought to be careful about what prompts you to do them.
Often we may not be able to particularly spell out our intention behind an action before we embark on it. But at the same time, at the back of our mind, there is some intention of which we are vaguely aware.
If we are good Muslims, the intentions behind our deeds are most likely to be good, even when we just impulsively act, as it were.
All the same, it is always advisable that before we begin any significant work, we need to pause and ponder over the objectives behind it as well as over the possible consequences following it.
That is to say, we should make it a habit to THINK and act.
And as Muslims, our duty is to increase our good deeds, so that they will stand us in good stead in the hereafter. Our good deeds erase our bad deeds too. This is how we can avoid hell fire. The point is to do good deeds against all odds.
Fear of Showing Off
Now the question raised here is a peculiar one: Here is a person who avoids doing good deeds for fear that people will see him/her. Is it a correct position as regards Islam?
Here we need to consider the purpose of this particular injunction regarding our actions: That it is not enough that the act is good by itself, but the mind of the doer is equally significant. The mind of the doer that controls the action should be free from selfishness or greed.
That is to say, the mind should be kept free from the impurity of any evil purpose.
The questioner is doubtful or anxious about the possible corrupting influences of the circumstances, such as people noticing.
This is a real risk, no doubt. But at the same time, we must recognize the fact that Allah Almighty has created us weak, and we are not perfect. There will be slips and lapses on our part. Of course, we should always be careful to avoid them.
But we cannot stop doing good deeds for that reason.
Beware of Shaytan’s Tricks
For instance, if you see a man who is about to carelessly step in front of a fast-moving car, your duty is to save him right away, whether people are watching or not.
It certainly is a trick of Satan to make people over-scrupulous about their good deeds so that they let go of the wonderful opportunities for doing good deeds.
After every act of goodness we should pray to Allah the All Merciful to accept it and forgive any lapse on our part.
Remember the supplication we are taught:
Our Lord, accept from us (our good deeds), certainly You are the All-Hearing, All-Knowing; and turn toward us in forgiveness, as You are Oft-Returning and Merciful.
What is important is to keep on doing good deeds and keep on praying to Allah Almighty to accept our good deeds and forgive our failings. You need not attain 100% purity of intention before an act of goodness. Nor is it easy for humans to attain it.
We should always strive for the best and the highest ideals, fully knowing that perfection is unattainable for humans. Over scrupulousness or “scrupulosity” according to psychologists is an aberration, akin to what they call “OCD” (obsessive compulsive disorder) a mental infirmity.
Focus on Priorities
So we need to be careful: we need to keep a balance in our daily activities. We should lead normal lives like all other humans, all the while taking particular care to remember Allah Almighty. Our religious practice, as well as our attitude to religion, should be balanced.
Our religious practice, as well as our attitude to religion, should be balanced.
Allah Almighty has said in His Holy Quran:
Say: “O people of the Book! Exceed not in your religion the bounds (of what is proper), trespassing beyond the truth.. (Quran 5:77)
This is applicable to Muslims, too, when they exceed the bounds of what is proper in religion.
So scrupulosity in excess should be avoided. To overcome scrupulosity you need to learn and enact the fundamental principles of the religion properly. This includes not allowing less important details of religious practice to replace or overshadow the more important ones.
In fact, one major error seen among religious people is to be careless about the priorities of faith and practice. Often we find people holding fast to the letter of the law at the expense of their spirit.
Refraining from doing good deeds for fear of people watching them is just one example.
You have asked: “How can I be sure that I’m sincere in what I do?” The answer is: Remember Allah always, particularly when you are about to embark on a good venture. And drive out all except Allah from your mind at the time.
Be sincere. That is enough. And do not try to measure your own sincerity. No need for that.
And everything will be fine, insha Allah.