Indeed, while mankind will be a major factor in the undoing of wrong and injustice, we simply couldn’t do that on our own. All the pieces of the great and intricate clock we’d cited before  — all the key and low-key phenomena that go into life as we know it (and life as we don’t) — will play a part as well.
In fact, all of that is now honing and readying the world for the undoing of wrong. Left to its own devices, wrong would flourish only too well, to be sure; but all is getting set for its undoing.
And so it’s clear why mankind has to have a yetzer harah with all the wrongful, self-centered drives that it feeds into — so we could learn to restrain and rise above all that. Know, however, while that element of our being — our ingrown imperfection, and all our smallness and malevolence — will be with us for the meanwhile, it will all prove to have helped advance us in the end .
Thus, all the factors that go into the eventual undoing of the world’s wrong and malevolence will also contribute to the undoing of our own wrongdoings .
Stepping back to present the big picture once again, Ramchal now emphasizes the fact that all this started at the beginning.
G-d fashioned a world from the first that would meet the physical and spiritual needs of Adam and Eve, including the existence of wrong and evil . That is the world as we now know it, which is termed “The World of Divine Service” (Olam Ha’Avodah). It’s termed that because it’s the environment in which we’re to serve G-d but in which we’re capable of not serving Him too, should we make that mistake.
But there’s another realm that factors into everything that happens here as well, known as “The World of Restoration” (Olam HaTikkun). It’s the one within which G-d has everything head toward the restoration of all that had been lost through Adam and Eve’s error, and in the direction of the eventual revelation of G-d’s sovereignty. Though it functions in the background to be sure, it nonetheless factors into our reality .
After having put all that into place, G-d then arranged for all the various factors that occur in this world  to help along the whole process of ultimately undoing wrong and injustice, and of eventually elevating man to his high potential.
 See 3:5:2, 3:9:2.
Understand that the Kabbalistic references we’d cited in the last two chapters which address the various phenomena that occur in the world refer to their heavenly components. They all play themselves out here “on the ground” as well, to be sure, and that’s a very important fact to underscore, as it touches on a central idea throughout Kabbalistic literature as well as throughout Ramchal’s own writings. And that is that everything that happens in the world (from essential to circumstantial) has its roots in the heavens, which have their roots in G-d’s intentions for the universe.
 Ramchal is bringing in the yetzer harah here in order to tie in our own personal failings with universal instances of wrong and injustice. See 3:7-8.
 That’s to say that while we’re certainly free to make moral and ethical mistakes having been granted free will, the point is that G-d’s ultimate goal will have been achieved in the end thanks to us (and everything else that will factor into it) or despite us.
 See 1:9 (and note 8 there for other references) on Adam and Eve’s functions.
 See 1:15:1-2 (especially note 9 there that refers to a “value-based rule” which is synonymous with the above cited “World of Divine Service”, and to a “Yichud- and perfection-based rule” which is synonymous with “The World of Restoration” spoken of above; also see 1:18:1-2 (especially note 1 there).
 As well as all of their heavenly elements, of course.
Rabbi Yaakov Feldman has translated and commented upon “The Gates of Repentance”, “The Path of the Just”, and “The Duties of the Heart” (Jason Aronson Publishers). His works are available in bookstores and in various locations on the Web.