Praise be to Allah.
Sexual fantasies are a type of thought that may cross a person’s mind. Whatever a person thinks of to himself, if he does not allow it to take root or persist in thinking about it, is forgivable, according to scholarly agreement.
Passing thoughts are forgivable, but the individual must ward them off and not get carried away in dwelling on them.
It is not permissible for the Muslim to consciously bring such thoughts to mind and become absorbed in dwelling on them, and it is also not permissible for him to let himself get carried away in thinking about things that cross his mind, for that will lead him to what is haraam.
See the answer to question no. 84066 .
Envy (hasad) is a blameworthy characteristic, and the Muslim should strive to rise above it. Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: It was said that envy means wishing that that with which Allah has blessed someone else will be taken away from him, and it was said that it means resenting that with which Allah has blessed someone else. The former definition is the well-known view among the scholars, and the latter is the view of Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him). Simply resenting that with which Allah has blessed other people is regarded as envy. Envy is haraam, because the Prophet (blessings and peace of Allah be upon him) forbade it. It is one of the characteristics of the Jews who envy people for what Allah has given them of His bounty, and the harm it causes is extensive. End quote from Fataawa Noor ‘ala ad-Darb (24/2).
With regard to sins that are committed when one is alone, there is a hadith which was narrated by Ibn Maajah (4245), from Thawbaan (may Allah be pleased with him), from the Prophet (blessings and peace of Allah be upon him), that he said: “I certainly know people of my ummah who will come on the Day of Resurrection with good deeds like the mountains of Tihaamah, but Allah will make them like scattered dust.” Thawbaan said: O Messenger of Allah, describe them to us and tell us more, so that we will not become of them unknowingly. He said: “They are your brothers and from your people, worshipping at night as you do, but they will be people who, when they are alone, transgress the sacred limits of Allah.” Classed as saheeh by al-Albaani in Saheeh Ibn Maajah.
Al-Haafiz Ibn al-Jawzi (may Allah have mercy on him) said:
Beware of sins, especially the sins committed when one is alone, because audaciously committing sins when you know that Allah is watching will lead to one becoming insignificant in His sight. Tend to your relationship with Him when you are on your own, and Allah will grant you well-being before people. End quote from Sayd al-Khaatir (p. 207).
See also the answer to question no. 134211 .
What appears to be the case is that this hadith does not refer to everyone who commits sin when he is alone, because no one can be free of minor sins. The Prophet (blessings and peace of Allah be upon him) said: “Every son of Adam is prone to sin, and the best of those who are prone to sin are those who repent.” Narrated by at-Tirmidhi (2499); classed as hasan by al-Albaani in Saheeh at-Tirmidhi.
What appears to be the case is that this hadith refers to hypocrites or showoffs, who make a show before people of righteousness and piety, but when they are far from people’s gaze, they show their true colours, so they do not respect the sacred limits of Allah, may He be glorified and exalted.
Ibn Hajar al-Haytami (may Allah have mercy on him) said:
The three hundred and fifty-sixth sin is: behaving outwardly like righteous people in public, and transgressing the sacred limits, even by committing minor sins, in private. Ibn Maajah narrated, with an isnaad of which the narrators are trustworthy, from Thawbaan, from the Prophet (blessings and peace of Allah be upon him), that he said: “I certainly know people of my ummah who will come on the Day of Resurrection with good deeds like the mountains of Tihaamah, but Allah will make them like scattered dust…”
Then at the end of the discussion he said:
Note: this explains the apparent meaning of the first hadith, and that is not far-fetched, even though I have not seen any other scholars quoting it, because the one whose habit is to present himself in a good light in public and commit evil in private will be a cause of great harm and will cause Muslims to be misled, because he has no fear of Allah in his heart. End quote from az-Zawaajir ‘an Iqtiraaf al-Kabaa’ir (356).
Based on that, the one who pretends outwardly to love people, but in reality he resents and envies them, is regarded as being among those who commit sin when they are alone.
Similarly, with regard to the one who makes an outward show of being righteous when he is not like that, or he pretends to be a man of dignity and chastity, but when he is alone he brings his corrupt thoughts to mind, there is the fear that the stern warning mentioned in this hadith will apply to him, which is the loss of his good deeds.
We ask Allah to pardon us and to grant us well-being.
And Allah knows best.