The Prohibition Against Impure Thoughts: “Scripture ( Ecclesiastes 12,14) teaches us that God judges every action according to the person's hidden feelings. If a man inadvertently happens to see a beautiful woman and allows himself even a momentary impure thought while looking at her , he should not think that he did not commit a transgression because he had not gone out on purpose to be attracted by her charm. The statement that God judges man according to his hidden feelings applies in such cases also. Even pleasure at the sight of an unexpected sensual stimulus is a transgression. We should regard as a punishment the mere fact that we were given occasion for impurity without our having gone out to look for it. On the other hand, one who gets an unexpected opportunity to perform a mitzvah should rejoice and give thanks to God Who has given him this unsought opportunity to do good.” Sefer Chasidim , 177, (12th century) as translated in the monthly journal Jeshurun , 1