Behold, the Torah prohibitions that concern forbidden thoughts (like worshipping idols, heresy, and sexual fantasies) are considered transgressions, even if they are not acted upon at all. The thought itself is already a transgression.
(This article is excerpted from the book, "Taharat HaKodesh," by the Gaon and Kabbalist, Rabbi Aharon Ratta, z'tzal)
For example, if a person thinks that the doctrines of a false religion are true, or if he fantasizes about worshipping idols, he needn't actually go and worship them. Just by the thought alone, a large impure spiritual husk (klipah) is created in the upper worlds, larger than the husk created by the actual deed.
Likewise, the thought of a sexual violation does not have to be followed by the act to be a wrongdoing. The thought itself creates a destroying spiritual angel with all of the 248 organs, and this angel will not be quiet or rest until it takes vengeance on the person, G-d forbid, now or at some later time, or both.
In his book, "Ohr Yehuda," the holy Magid from Kotzitz explains what is written in the "Tikunei Zohar" on this matter (Folio
that someone who willfully fantasizes about a woman is considered to have willfully committed the forbidden act. Moreover, the evil spiritual forces which his fantasizing create invade his thoughts during times of Torah study, prayer, and when he performs a commandment, in order to distract him with foreign thoughts, foolish ideas, and vanities.
It is precisely sinful thoughts that prevent a person from cleaving to G-d.
Sinful thoughts numb the brain and the heart, and transform his faculty of reason (daat) to that of an arrogant fool's.
Sinful thoughts numb the brain and the heart, and transform his faculty of reason (daat) to that of an arrogant fool's.
Even more than this, all transgressions find rectification through the forging fires of Gehinom, except for transgressions of a spiritual nature like thoughts which have no tikun (rectification) in Gehinom, since they are related to a more spiritual realm than Gehinom which belongs to the world of doing. Therefore, even if a man has already been rectified and refined by the great and frightening smeltery of Gehinom, and awaits his entry into Gan Eden (the Garden of Eden), his forbidden thoughts converge on him and don't allow him to enter.
Our blessed Sages hinted at this when they said, "Anyone who willfully thinks forbidden sexual thoughts is not allowed to enter the courtyard of the Holy One Blessed Be He" (Niddah 13B) He will need another great and terrible tikun in his next very painful reincarnation...if he doesn't make penitence and rectify his thoughts.
Therefore, someone who blemishes the Brit, G-d forbid, his repentance is difficult, because it requires a great amount of devoted work to uproot all of the impurities and blemishes that he caused. Nonetheless, the Holy One Blessed Be He is merciful and forgiving, and if a Jew tries his hardest, then certainly in His great mercy, He will accept the penitence of those who return.
Just see, my brother, the words of the holy Zohar, that a loud and strident proclamation is made every day in Gan Eden, saying "Who is this who has clung to the Tree of Life, the source of the Jewish People, called Tiferet Yisrael (Zohar, Parshat Miketz, 193A). For everyone who is found there draws upon himself life and healing to his soul and body. And who is this? Those that guarded themselves from forbidden thoughts and fantasies, for forbidden thoughts pollute Israel's source, because these thoughts rise up to the celestial root of his soul which is attached to the Tree of Life, and pollute its very roots, thus causing his soul to be polluted below....
When a holy Jew lives a life of Torah, prayer, and good deeds, he adds light to his soul. For when a man is born, he is given but a little of his soul's potential. Then at his bar mitzvah, he is granted enhanced holiness. Afterward, as he increases Torah and good deeds, additional illumination and portions of his soul are granted to him from the root of his soul in heaven.
However, if he has a sinful thought, G-d forbid, he pollutes his very source, and all of the additional holiness that he accumulated is lost. Therefore our rabbis, may the remembrance of them be for a blessing, stated that the thoughts of a transgression are worse than the actual transgression itself (Yoma 29A), for the damage is greater, rooting itself in the highest reaches of the heavens, G-d forbid.
Therefore, you should know, my brother, the moment that you think of a sinful matter, you uproot yourself from the root of Israel's holiness, and create a great and terrifying evil force. At that very moment, the root of your soul is set burning in Gehinom, as the Talmud teaches, regarding Rav and Rav Yehuda, that a man should not walk behind a woman, but rather hurry his steps to walk before her, in order to save himself from falling into Gehinom (Kiddushin 81A).
And this caution was attributed to Rav, the holiest of Sages, of whom it was said that he never uttered a needless conversation in his life, and never gazed beyond four cubits. Other commentators said that Rav was Rabbi Abba of the Zohar, the most important student of Rabbi Shimon Bar Yochai. Yet, he still didn't trust himself not to have a sinful thought when walking behind a woman, in the fear that his thoughts about her would cause him to fall into Gehinom, G-d forbid.
Therefore my dearly loved brother, have pity on your soul that you shouldn't cause it to descend to the depths because of an evil thought, G-d forbid, nor bring upon yourself cruel and unnatural reincarnations, may Heaven have mercy.
(From the chapter, "Taharat HaMachshavah," 4-8)
http://www.jewishsexuality.com/content/view/95/61/