Moses instructed the Jewish people to appoint judges and sheriffs throughout the Land of Israel to try cases and uphold the law.
Personal Judges and Sheriffs
שֹׁפְטִים וְשֹׁטְרִים תִּתֶּן לְךָ בְּכָל שְׁעָרֶיךָ וגו': (דברים טז:יח)
[Moses instructed the Jewish people,] “You must appoint judges and sheriffs for yourself in all your cities.” Deuteronomy 16:18

The Hebrew word for “cities” used here (she’arecha) literally means “gates.” The “gates” of our bodies are our ears, eyes, nose, and mouth, through which stimuli from the external world enter our bodies and our personal world. This verse thus requires us to station “judges and sheriffs” to guard these “gates” against the intrusion of any stimuli that could be harmful to our spiritual health. Through studying the Torah, we learn which influences are beneficial (and therefore permitted) and which are harmful (and therefore forbidden). The job of the “sheriff” is to enforce the decisions rendered by the judge. Our inner “sheriffs” are the techniques that each of us needs to cultivate in order to combat the voices within us that oppose the decisions of our inner “judges.”

Thus, regarding the Messianic future, G‑d only promises to “restore your judges as in former times,” but not the sheriffs. In the Messianic future, negativity will not hold sway over us, so there will be no need for protective measures to ensure that we follow G‑d’s will.1