"Whoever occupies himself with Torah study…." (Avot 6:1)

The emanation of the words unites with the supernal speech….

It is written, "If you walk in My statutes…then I will give you your rains in their season" (Lev. 26:3-4). Now, we know that the important element in the worship of the blessed Creator is devotion, adherence and fervor in His service and in the study of His Torah, so that it should be in holy trepidation. By virtue of this, a person is able to bind himself to G‑d [as it were], because the emanation of the words unites with the supernal speech; and the same holds for the thought [of his Torah study].

As our Sages said, the Shechina would speak from the throat of Moses [see Zohar III 219a, Raya M'hemna], because by virtue of his great holiness and devotion to G‑d, he would actually unity with his divine root. Hence it was as if the Holy One was speaking Moses' words. Through this his physical self was purified, and he became a man of G‑d. Thus it is written, "Take off your shoes from your feet (Ex. 3:5), because they are physical, material….

If some outside, alien thought comes to a person during his Torah study or his prayer, it is not by chance….

Now, when a man entertains a thought, whatever it may be, he thinks letters of the alefbet [i.e. the elements of the words that form or underlie his thinking]. You know, too, that if some outside, alien thought comes to a person during his Torah study or his prayer, it is not by chance or accident, for there is a time for every object…. Then the man needs to become greatly stirred and inspired; then because this outside thought has not come to him for nothing, but only to be raised [to the level of holiness] …and if not now, when? Possibly he will not have another opportunity…since, generally, as a rule, the thought comes from some topic resembling the theme of his prayer or benediction, or out of the subject of Torah study in which he is engaged.

For example, a beloved son relates a matter of religious law to his father, who then poses various problems and difficulties, trying to mislead him from the way of the true, plain meaning. The father's intention is not to demolish what his son says or to confuse him so that he should remain perplexed and under a misconception. Far from that, the father merely intends to sharpen his son's thinking, making the son find ways to refute the superficial or apparent difficulties and answer them soundly, so that he will make his way on the path of truth and clear thinking in the plain meaning of the religious law. This is the father's wish and his joy [when his scheme works]. As Scripture says, "My son, be wise, and make my heart glad" (Proverbs 27:11).

When the alien thought arrives, the person needs to become greatly stirred….

The meaning of the illustration is obvious. [The tester is the evil inclination, which send the stray, alien thought, so that it may be raised and transmuted.] For when the alien thought arrives, the person needs to become greatly stirred, and to raise it to a higher level in holiness, with those holy thoughts that he bears in mind and fuses with the words he utters [in his Torah study or prayer]. This, too, is the recondite sense of the teaching in the Midrash that "vessels within vessels may be immersed for ritual purification" (Hagiga 3:1): The vessels denote the letters of the alien thoughts. They are to be immersed and purified within [other] vessels - i.e. the holy letters [of Torah study and prayer]. By such means all will be clarified to merge with the supernal holiness.

We are not to remain in one place….

Hence, too, Scripture says, "If you will walk in My statutes" (Lev. 26:3), which our Sages interpret to mean the study of Torah (Sifra). The term "walking" is used to denote that we are not to remain in one place, at one spiritual level, but are to progress constantly, rising form grade to grade in devotion and fervor, until we reach the highest level, to unify our thought in the heavenly realm with all the worlds - just as someone might ascend from one world to another.

Then, Scripture says, "I will give you your rains in their season" (Lev. 26:4). The Hebrew word for "your rains" ["gishmeichem"] alludes to your material, physical [in Hebrew, "gashmi-im"] aspects of life; they will be purified and refined. Moreover, this spark of alien thought will occur to you "at its proper season", meaning at its necessary time, when you are able to raise it to the level of holiness, thus letting the spark of holiness in it ascend.

[From "Baal Shem Tov on Pirkei Avot"; Keter Shem Tov; Likutim Y'Karim; Or Torah, bechukotai. (5)]