The Midrash states, "Even if a person is a rasha, if he trusts in Hashem, he will be enveloped in Hashem's kindness." The Midrash learns this from the pasuk (Tehillim 32:10) יסובבנו חסד 'בד והבוטח, "For the one who trusts in Hashem – Hashem's kindness will surround him." No conditions are given. He doesn't have to be a tzaddik. He doesn't have to be perfect. 'בה והבוטח, if he trusts in Hashem, he will receive Hashem's kindness.
Reb Elchanan Wasserman zt'l expressed it this way: No one is perfect, as it states (Koheles 7:20) ולא טוב יעשה אשר בארץ צדיק אין אדם כי יחטא, "For there is no righteous man on earth who does good and sins not." If so, who can have bitachon? Who can feel worthy that Hashem will certainly help him? It must be that bitachon is for everyone. Regardless of one's deeds, when he trusts in Hashem, he will receive Hashem's kindness.
Another source is (Tehillim 37:3) ועשה 'בד בטח טוב, "Trust in Hashem and do good." The Ramban says,'בד בטח is written in this pasuk before טוב ועשה, because one can have bitachon before he begins to do good. The Midrash (Shochar Tov, Tehillim 25) tells the following mashal:
The police arrested a foreigner. The foreigner told them, “Please! Don’t hit me. I'm a member of the royal household.” The police accepted his plea and didn’t harm him. But they kept him under guard all night and in the morning they brought him to the king. They said, “We found someone from your household.”
The king asked the foreigner, “My son, do you know me?”
“No. I don’t.”
“So why do you say you are from my household?”
He replied, “I beg you, I am not from your household, however, I trusted that you would help me, so please save me.”
The king accepted his pleas and told the officers, “Since he trusted in me, let him go.”
The Midrash talks that about this when Dovid HaMelech says (Tehillim 25:2), בך אלקי בטחתי, "Hashem I trusted in You. [I relied on You. Therefore, I request] לי אויבי יעלצו אל, that my enemies shouldn’t rejoice over me [and harm me]." I placed myself in Your hands, I trusted in You, so You should help me.
We say in the piyut of Rosh Hashanah and Yom Kippur, ולטובים לרעים ומטיב הטוב, that Hashem is good and does kindness to all, for the good people and for the bad people. This occurs even when they don't have bitachon! Hashem helps every creature, good or bad, deserving or undeserving. Hashem's kindness spreads to the entire world. Certainly, when one relies on Hashem, he will merit Hashem's compassion and kindness.
With this information, we begin to understand the root of the meraglim's error. The meraglim frightened the nation with their report of the mighty countries living in Eretz Canaan. The nation cried all night long. They were certain that they would be killed at war.
The meraglim said (13:) כי העם אל לעלות נוכל לא ממנו הוא חזק, "We are unable to go up [to Eretz Canaan]... for they are stronger than we." Rashi writes that ממנו הוא חזק means they thought that the nations living in Eretz Yisrael were stronger than Hashem, keviyachol.
But why were they so afraid? The Jewish nation had witnessed Hashem's strength not long before. They saw the ten makos, yetzias Mitzrayim, and Kriyas Yam Suf.
1. Rashi (13:2) writes that Bnei Yisrael asked Moshe Rabbeinu to send spies. Moshe asked Hashem, and Hashem granted their request.
Sifsei Tzaddikim explains that Hashem wanted they should send spies. Hashem wanted the nation to know of the mighty giants who live in the land so they would know that the conquest of the land is solely with miracles – a gift from Hashem – and not through the rules of nature.
We add that Hashem wanted the Yidden to discover the extent of His love for them, even after they commit aveiros. Hashem performed miracles for them even after they sinned with the egel.
2. The Imrei Emes zt'l said, "If חנם של בכיה, crying for no reason, resulted in לדורות בכיה, generations of crying, Sifsei Tzaddikim (from Rebbe Pinchas of Dinavitz zt’l) explains that the meraglim's error was that they thought that after they committed severe aveiros – the egel and other aveiros (mislonanim, see Bamidbar 11:1-4), Hashem won't perform miracles for them. From the meraglim's report, they knew that according to the rules of nature, it was impossible for them to conquer Eretz Canaan, and they didn’t believe Hashem would perform miracles for them. But they were wrong. They could trust in Hashem, and Hashem would perform miracles for them.
