The Bible is very clear that God has nothing to do with evil. There is “no darkness” in God. (I Jn 1:5). Far from intentionally bringing about evil, God’s “eyes are too pure to look on evil” (Heb. 1:13). All evil, therefore, must be ultimately traced back to decisions made by free agents other than God. Some of these agents are human. Some of these agents are angelic. Either way, evil originates in their willing, not God’s.
This isn’t to say that God can’t bring good out of evil. Scripture teaches that “in all things God works for the good of those who love him…” (Rom 8:28). As I read this passage, the phrase “works for” (sunergēo) is all important. In the Greek, “sun” is a prefix meaning “with” or “alongside of.” “Ergēo” means to work to bring something about (we get the word “energy” from it). So the term literally means to work with or along side other things or other people to bring something about. So, it seems that in this passage God is promising to work with us and alongside the circumstances he finds us in to bring good out of evil.
But think about this. If “all things” were already an expression of God’s will, because God is supposedly behind everything, why would God have to work with us and alongside circumstances to bring good about? If all things are already an expression of God’s will, there’s nothing outside of God’s will for him to work with or alongside of.
In this light, I suggest the passage is teaching us not that all things happen for a divine purpose, as though God wills all that comes to pass, but that all things happen with a divine purpose. Whatever comes to pass, however much against God’s will it may be, God works to brings a good purpose to it.
He is, after all, an infinitely intelligent God who is able to anticipate each and every possible event as if it were a certainty. Whatever comes to pass, therefore, God has an eternally prepared plan in place on how best to respond to it. I believe this is why the Bible depicts God’s providence not only as a rule of power, but even more so as a rule of wisdom. If God himself brought things about or faced an eternally pre-settled future, devoid of possibilities, he’d need no wisdom in steering the world toward his objectives.