When the spies returned from Eretz Cana'an and painted a bleak picture of the land, Bnei Yisrael lost interest in the Promised Land: "And they said one to another, 'Let us appoint a head and return to Mitzrayim'" (Bamidbar 14, 4). Rashi cites two possible explanations for the term "a head." According to the Targum their intention was to appoint a new king, while according to Chazal they were expressing an interest to create an avodah zara which would lead them back to Mitzrayim.
Rav Wolbe (Shiurei Chumash) comments that these two explanations are actually very similar. It was clear to all that Moshe was Hashem's emissary, and he led Bnei Yisrael in exact accordance to the will of Hashem. If Bnei Yisrael would replace Moshe with a king whom they themselves had appointed, they would be declaring that they are no longer interested in following the will of Hashem. This, to a certain extent, is like avodah zara.
Shortly afterward, the Torah describes Bnei Yisrael's deviation from Hashem as adultery. "Your children will roam the desert for forty years and bear your ze'nus" (ibid. 14, 33). Bnei Yisrael were afraid to enter Eretz Yisrael because in the natural course of events there was absolutely no way they could conquer a land full of giants. Therein lay their problem. Hashem had performed numerous miracles for them which should have allowed them to realize that nature simply does not stand in His way. Since Bnei Yisrael are, so to speak, married to Hashem, when they deviated and gave supremacy to nature as opposed to Hashem, they were, to a certain extent, guilty of adultery.
Although we cannot fully comprehend the transgressions of that spiritually awesome generation, we can take a lesson from the Torah's description of their sins. Ascribing greatness or power to anything which runs contrary to Hashem's will contains slight traces of avodah zara and adultery. On the other hand, one who, despite all forms of pressure, faithfully heeds His will, stands to gain not only in the next world but also in this world. As mentioned in this week's parsha, Yehoshua and Kaleiv who refused to go along with the other spies would be the only two men from that generation who would merit entering the Promised Land!