The Talmud likens one who studies Torah but lacks yiras shomayim to the trustee of a house with many doors who is given only the keys to the interior doors; he lacks the keys to the entrance. Rabbi Yannai says: "Woe to the person who lacks a domicile yet makes a door for it."
Yiras shomayim is the dwelling and Torah is its door. Rashi, in his commentary on the Talmud,1 states that Torah is the portal through which one passes in order to obtain yiras shomayim.
The two above-mentioned opinions seem to be in conflict. According to the first, Torah and yiras shomayim are [both] likened to keys, yiras shomayim being the external keys and Torah the internal keys; [i.e., yiras shomayim precedes Torah. According to Rabbi Yannai, however, Torah likened to a door precedes yiras shomayim, which is likened to a domicile.]
The apparent conflict is resolved by the Mishnah in Pirkei Avos (Ethics of the Fathers) which states:2 "If there is no fear, there is no wisdom; if there is no wisdom, there is no fear."
This Mishnah needs to be properly understood, for it seems that there is no clear point of departure. Beginning one's spiritual service with fear of G-d would seem to be pointless since one lacks wisdom, but on the other hand, beginning with wisdom also seems pointless, since the person lacks fear of G-d. Spiritual service must have a beginning and an end, but according to the parameters set out by the Mishnah, this seems impossible.
The matter is as follows: there are two levels of fear: "yirah ila'ah," the "higher level of fear," and "yirah tata'ah," the "lower level of fear." Within wisdom of Torah too there are two levels: yirah tata'ah is an introduction to Torah, and Torah is a prelude to yirah ila'ah.
It is written:3 "For G-d is all knowledgeable (deyos)." This refers to the two levels of knowledge. The lower level is that of created beings who consider themselves to actually exist. Such beings call their source ayin, or "non-being," since it is incomprehensible to them.
Yirah tata'ah emanates from this lower level of knowledge, concerning which it is written:4 "All the earth shall fear Him." It arises from the realization that all was created from but a glimmer of G-dliness. The level of yirah tata'ah is an introduction to [the wisdom of] Torah.
The higher level of knowledge is Supernal Knowledge, namely, that all true existence is Above, and created beings are "all before Him as naught." When a person understands that G-d is the only true existence, he will reach a state of total self-nullification yirah ila'ah. Torah is a prelude to this level.
These then are the two levels of yirah tata'ah and yirah ila'ah, the former arising from the lower level of knowledge that is an introduction to Torah study; the latter stemming from contemplating the higher level of knowledge, for which Torah is both a prelude and a vessel.
In summary: The apparent contradiction between the two analogies concerning an individual who possesses knowledge but lacks yiras shomayim is explained with the saying: "If there is no fear, there is no wisdom; if there is no wisdom, there is no fear." There is a higher and a lower level of knowledge. Yirah tata'ah is an introduction to Torah, and Torah is a vessel for yirah ila'ah.