The secret lies in theheart!
Two persons may perform the same righteous deed, yet it is accepted from one of them but not form the other. For example, two men pray side by side and the prayer of one gets accepted; whereas the other one only gets a partial reward for his prayer, according to how much he focused therein. The Prophet (may Allah’s peace and blessings be upon him) said:
“Indeed, a man may perform a prayer and gets no reward for it except a tenth, a ninth, an eighth, a seventh, or a sixth thereof.”
[Narrated by Ibn Hib bān; Sahīh (authentic)]
Also, a person may give charity and Allah accepts it from him and even fosters it for him, as we foster our own foal. And another person may give charity and Allah turns it down and even punishes him for it.
{If you give charity publicly, it is good; but if you give it secretly to the poor, it is better for you, and He will expiate some of your sins. And Allah is All-Aware of what you do.}
[Surat al-Baqarah: 271]
One may pretend to lower his gaze while other people are around, yet when he is alone, he gives free rein to his eyes and violates the prohibitions set by his Lord. Only the All-Aware and All-Seeing Lord watches over what he does and knows what is in his heart.
{He knows the fraud of the eyes, and all that the breasts conceal.}
[Surat Ghāfir: 19]
Leading a life between obedience and disobedience carries the risk of not knowing during which of them your life will come to an end.
How you act when you are alone may raise or lower you. Whoever extols Allah Almighty in his time of seclusion, people will revere him when he is in public.
Imam Mālik (may Allah have mercy upon him) said:“Whoever likes to have relief within his heart and be saved from the throes of death and the horrors on the Day of Judgment, he should perform more good deeds in secret than in public.”Ibn Rajab (may Allah have mercy upon him) said:“Only a person whose inside is good will have a good ending for his life, as none can be pretentious in the moment of death.
It is only what lies within the heart that comes out then.”Allah Almighty states that He is the All-Aware. He even couples His name “the All-Aware” with what people do and know more than twenty times, urging His servants to fear Him.
{...Be just; that is nearer to righteousness. And fear Allah; indeed, Allah is All-Aware of what you do.}
[Surat al-Mā’idah: 8]
Allah also urges us to consider our outward and inward deeds. The more one believes in the name “Al-Khabīr”, the more he becomes aware of what takes place in his own world, namely his heart and body, including his innermost thoughts and secrets, like cheating, treachery, and evil intent.
Allah Almighty does not look at our forms or appearances, but He looks at our hearts and deeds.
{But does he not know that when the contents of the graves are scattered.And that within the breasts is obtained.Verily, on that Day their Lord will be All - Aware of them.}
[Surat al - ‘Ādiyāt: 9 - 11]