The Mishna (28a) taught that the kohanim were sent to search the skies on Yom Kippur morning in order to ascertain when the sun had risen and the Temple service could begin. The explanation for this procedure was that an error had once taken place and the light from the moon had been mistaken for the light of the sun.
In the course of discussing how this error could have taken place, the Gemara explains the difference between how the light of the sun is perceived, in contrast with the light of the moon, and concludes that only on a cloudy day could such a mistake have been made. This discussion leads the Gemara to quote a list of comparisons made by Rav Nahman.
The hazy light of the sun through the clouds is more damaging than the light of the sun itself…Dazzling sunlight, which shines through cracks in the clouds, is more harmful to the eyes than direct sunlight…Thoughts of transgression are worse than transgression itself…
The sin that is usually referred to by the Gemara when it uses the term aveira is a sin of a sexual nature. Thus, it appears that Rav Nahman is saying that forbidden sexual thoughts are worse than forbidden sexual acts, a statement that demands explanation.
Rashi explains that this does not refer to the severity of the sin, but to the lust that accompanies thinking about the sin, which is even greater than what exists during the sinful act itself. Nevertheless, most commentaries understand the statement to be referring to the severity of the thought and the act.
In the Moreh Nevuchim, the Rambam explains that the mind, the intellect, is on a much higher level than physical activities. Therefore, sinning in one’s thoughts creates greater damage to the person than does an act of sinning.
The Ohr ha-Hayyim suggests that once someone has sinned, he has satisfied his inner need and is ready to begin a process of teshuvah – repentance – leading to atonement.
Sinful thoughts which are never acted upon, however, never satisfy the person, and he will never try to undo or repent from them.