Sefer M’Zekeinim Esbonen (Chelek 1, page 144) quotes Rav Mordechai Chaim of Slonim zy”a as quoting Rav Shmuel of Kaminka zy”a, who explains this pasuk as follows:
“And you shall remove the evil from your midst.” This means that when a Jew removes bad traits from within himself, he provides benefit for all of Klal Yisroel and brings them to fear Hashem.
On this topic, Rav Mordechai Chaim of Slonim related that a group of people once came to the Apta Rov zy”a and told him about a certain ruchnius matter in their city that needed rectifying. He traveled to their city and fixed the breach in ruchnius. A short while later, some people came from a different city and said that there was a matter in their town that needed to be rectified. Again, the Rov went with them and fixed what needed to be fixed.
He then thought to himself: Is it my job to travel from city to city, rectifying everything that needs to be fixed? Wouldn’t it be better for me to stay at home and fix myself? By doing so, wouldn’t I be doing more for the world than I could do by running from place to place?
With this, he explained the words we recite in davening on Shabbos: “Tovim me’oros shebara Elokeinu. Yetzaram b’daas b’bina ub’haskel. Koach u’gevurah nasan lahem l’hiyos moshlim b’kerev teivel.” (The illuminations created by our G-d are good. They are made with wisdom, understanding and comprehension. Strength and might is given to them to be rulers in their world.) “Me’oros” is reference to tzadikim. If they rule over themselves and overcome their yeitzer hara, they become rulers over the entire world and provide goodness for everyone.
Sefer M’Zekeinim Esbonen adds that this is hinted to in the Gemara (Yoma 83B) that states: “When an individual does teshuva, he is forgiven and so is the entire world.” We see that one man’s teshuva can bring all those around him to do teshuva as well.