Nitai the Arbelite would say: “Distance yourself from a bad neighbor, do not cleave to a wicked person,
and do not abandon belief in retribution.”
(Pirkei Avot 1:7)
“Distance yourself from a bad neighbor and do not cleave to a wicked person.” This statement is the basis for understanding the words of Maimonides, who writes:
"A person who lives in a place where the behavioral norms are evil and the inhabitants do not follow the straight path should move to a place where the people are righteous and follow the ways of the good. If all the places with which he is familiar and of which he hears reports follow improper paths…, he should remain alone in seclusion…. If they are wicked and sinful and do not allow him to reside there unless he mingles with them and follows their evil behavior, he should go out to caves, thickets, and deserts [rather than] follow the paths of sinners….”
Have we ever seen a case of a great sage running away to the desert? Maimonides himself lived among non-Jews in Egypt, a decadent land. Furthermore, are we not charged with “perfecting the world under Divine sovereignty?” If so, who can give us permission to ignore our destined mission and flee evil in order to save our own skins?
The answer is that the directive to distance oneself from evil people is only a first step in a three-stage process of submission, separation, and sweetening, as taught by the Ba’al Shem Tov. The first stage, deserting society, is like a warning sign that corresponds with the attribute of submission in the soul. By following this directive, we are essentially admitting to ourselves that we are only human and therefore we are vulnerable and can be negatively influenced. No one can claim immunity from the adverse influence of ill-willed neighbors and friends. Later, however, we can achieve the stages of separation and sweetening.
The three-stage process is as follows: First, I submit to the fact that I cannot rely upon myself and am conscious that if I associate with negative people, I will join in with the crowd, for I also have a hefty evil inclination. I must seclude myself in the likes of “caves and deserts” so as not to be influenced by the wrong crowd.
If my submission has truly led me to distance myself from negative influence, then my next step is is to separate between my propensity for evil and my Divine soul within me, allowing me to foster my proclivity for good and kind behavior. Ultimately, I can rejoin society, using my renewed sense of having a mission to influence (instead of being influenced) society, thereby sweetening and rectifying reality. It is important to realize that the middle stage of separation affords me a firm footing on the positive aspects of my personality and being. If I have separated myself properly from the negative, I will be able to influence others with my positive stance and behavior. A person who is truly influencing his environment will not be influenced adversely by it. (A similar principle is found in the laws of kashruth. When a vessel is heated in order to kasher it, while it is expelling what it has absorbed, it will not simultaneously absorb anything new from its surroundings).
The three phrases of Nitai the Arbelite’s teaching parallel these three stages:
Distance yourself from a bad neighbor demands submission in order for us to distance ourselves in a virtual desert.
Do not cleave to a wicked person represents the stage of separation in which we separate ourselves from the wicked, as it were, even within ourselves.
Do not abandon belief in retribution represents sweetening. To sweeten our environment, we must not despair because of the evil we face. Know that it is upon you and in your power to rectify it. “The world was created for me” – so that I can rectify it.
 Hilchot De’ot 6:1.
 As per the “Aleinu Leshabe’ach” prayer, written by Joshua Ben Nun.
 Keter Shem Tov 28.
 Sanhedrin 4:5.