“You shall not curse judges, [and a prince among your people you shall not revile]” (Exodus 22:27). Rabbi Meir said: Above all, the Holy One blessed be He cautioned regarding the judges of Israel, who teach them justice, and regarding the king, as it is stated: “Do not curse judges, [and a prince among your people you shall not revile].”40Although it is forbidden to curse anyone, the Torah singles out judges and kings and states that one may not curse them.
Likewise you find that Koraḥ and his congregation were punished only because he extended his hand against Moses and Aaron. Likewise, the people of Jerusalem were punished because they demeaned the prophets, as it is stated: “They would insult the messengers of God” (II Chronicles 36:16), and it is written: “They have hardened their faces more than a rock, they refused to repent” (Jeremiah 5:3). That is why the Holy One blessed be He cautioned regarding the honor of the elders and the righteous.
Likewise it says: “To understand proverbs and aphorisms, the words of the wise and their riddles” (Proverbs 1:6). Why did He caution in their regard?41Why did God caution that one must be careful to honor the elders and the righteous? It is because they caution Israel against idol worship. That is why it is stated: “And everything that I have said to you, you shall observe, and the name of other gods you shall not mention” (Exodus 23:13).42The implication is that if all of the commands in the preceding passage are observed, including the command not to curse judges, which is based on the respect due to elders, the people will not come to worship idols.
What is written thereafter? “Three times a year” (Exodus 23:17). God established three pilgrimage festivals: the festival of unleavened bread, on which He performed miracles on their behalf in Egypt; the festival of the harvest, on which the Torah was given to Israel, whose fruits they eat in this world, as it is stated: “My fruit is better than gold and fine gold” (Proverbs 8:19); the festival of the ingathering, on which God fills their houses with blessing, as it is stated: “Honor the Lord with your wealth [and with the first fruits of all your produce]” (Proverbs 3:9).
That is why it says: “The choicest first fruits of your land [you shall bring to the house of the Lord]” (Exodus 23:19).43The command regarding the pilgrimage festival appears right after the verse regarding idol worship because traveling to the Temple for the pilgrimage festival will also help to prevent idol worship. Alternatively, it is because one who denigrates the festivals is comparable to one who worships idols (see Pesaḥim 118a).