The incident of the spies is one of the most well-known stories in the Torah and there is much discussion as to how such great men could commit such a terrible sin. Another very important aspect of this maaseh is the actions of the righteous men in their attempts to withstand joining in the sin. The Torah tells us that after sending the spies to Eretz Yisroel, Moshe renamed his closest student. Up till this point he was known as ‘Hoshea‘, but now Moshe added a ’yud’ to make the name ‘Yehoshua’. Rashi explains that Moshe davenned that Yehoshua would be saved from the nisayon posed by being with the meraglim - this tefilla manifested itself in adding a yud to his name. A few passukim later the Torah alludes to the fact that whilst in Eretz Yisroel, another of the spies, Kalev, separated from the group and went to Chevron to daven to be protected from the plan of the meraglim.
The Ben Ish Chai and Maskil leDavid both ask that these tefillas seem to contradict a well-known axiom, that ‘everything is in the hands of heaven except for fear of heaven.’ This means that the one thing that is completely in the control of man is the ability to choose between right and wrong. Davenning for things beyond our control, such as health and parnasa, can be highly beneficial because those things are totally dependent on Divine Providence. However, davenning to not sin would seem to have no benefit because Hashem does not determine whether we sin - that is completely in our hands. Consequently, it is very hard to understand why Moshe davenned for Yehoshua and why Kalev davenned for himself.to avoid sinning - whether they would sin or not was not dependent on Hashem, it was dependent on their own free will!
The Ben Ish Chai explains that there are two different ways by which a person can come to commit a sin. One is where he has total clarity that a certain act is forbidden but he nonetheless decides to do it with a clear recognition that he is sinning. The second is where his yetser hara clouds his judgment and persuades him that this act is permissible, enabling him to rationalize that he is not sinning at all. The principle that fear of heaven is completely in our own hands only applies to the first form of sinning, where a person is absolutely clear that acting in such a way constitutes a sin. In this area there is no benefit for a person to pray for Hashem to stop him committing this sin, it is purely in his own hands and Hashem cannot, so-to-speak, change his free will decision. However, this is not the case with regard to the second form of nisayon where a person may genuinely believe that he is not sinning. The main factor that causes him to sin in such a case is lack of clarity as to the correct course of action. This it not completely within one‘s free will. When a person wants to do the right thing but is at risk of being seduced by his yetser hara he can turn to Hashem to help him not be clouded by its rationalizations. Therefore, in this situation it is beneficial to pray to Hashem.
The Ben Ish Chai continues by explaining that Yehoshua and Kalev faced the second form of nisayon where tefilla can help. The meraglim were great people and did not deliberately speak badly about the land without justifying their behavior. The Ben Ish Chai offers a novel explanation of their motivations; they felt that if they would tell the Jewish people about the great prosperity of Eretz Yisroel then they would enter with impure motives of physical gain rather than purely as a result of following Hashem’s command. Consequently, they decided to speak badly about the land with the hope that the Jewish people would nevertheless want to enter the land, leshem shamayim and would thus gain far greater reward. However, in truth, this reasoning was really the work of the yetser hara’s attempts to prevent the people from entering the land at all, as indeed occurred. Moshe davenned for Yehoshua that he would be protected from such rationalizations that would make him believe that it was a mitzva to speak badly about the land! Similarly, Kalev prayed that he should maintain the clarity that would prevent him from falling into the clutches of the yetser hara.
We have seen that there are two ways in which a person can come to sin; either by knowingly sinning or by being duped by the yetser hara that he is not sinning at all. It seems that by far the more prevalent challenge is posed by the threat of being tricked into thinking that one is not sinning at all. The Nefesh HaChaim writes that a lack of clarity as to whether we are doing a mitzva or aveiro originates with the chet of Adam Harishon. Before the sin, Adam had total clarity as to what was good and evil, in his eyes, committing an aveira was as clearly damaging as putting one’s hand in fire. When he ate from the tree of knowledge of tov ve’ra he brought into himself a mix of good and evil. The consequence of this was that he lost that great clarity about the nature of evil, to the point that now, his yetser hara could now confuse him as to what is right and wrong. This is also the meaning behind that Gemara that states that when a person commits the same sin twice it becomes permissible in his eyes. Rav Yisroel Salanter was said to have commented that when he commits the sin a third time it becomes a mitzva in his eyes!
We have noted in the past the observation of the Baal HaTania that pertains to this point. He writes that if one were to offer a Torah observant Jew money to blatantly commit a sin, he will not do so because he intellectually understands that the spiritual damage done by the sin will outweigh any material gain. And yet a person sins without any monetary gain because he convinces himself that he is not actually sinning.
We learn from the explanation of the Ben Ish Chai that, with regard to the challenge of being tricked by the yetser hara, tefilla is a highly beneficial and necessary weapon. The yetser hara is constantly striving to deceive us into sinning and we must maintain a constant vigilance of being caught in the trap of rationalizations. As well as a consistent method of cheshbon hanefesh, the key tool to gaining clarity is to daven that Hashem help us open our eyes and enable us to follow the true path of Avodas Hashem.
 Shelach, 13:16.
 Rashi, 13:22.
 Ben Yehoyada, Sotah, 34b.
 Shelach, ibid. He is one of the main super-commentaries on Rashi.
 There are numerous other explanations as to the reasoning of the spies in speaking badly about the land (see Ramban and Sfas Emes) but it seems clear that whatever their reasoning they did somehow justify their actions and believe that they were not committing an aveiro.