“Since God is the highest good, He would not allow evil to exist in his works, unless His omnipotence and goodness were such as to bring good even out of evil. This is part of the infinite goodness of God that He should allow evil to exist, and out of it produce good.” Introduction to St. Thomas Aquinas pg27
God allows evil to exist so he can demonstrate his supremacy and ultimate goodness by making good out of evil.
The entire play of events that proceeds from Genesis to the end was a demonstration of Gods ultimate goodness and power to produce good from evil, before its final judgment.
The entire play of events from Genesis to the end is God seeking to redeem good from evil rather than to simply judge evil. A lesser god in power and goodness could only judge evil, but a greater god in both goodness and power could redeem and transform evil and make good of it.
If man has the ability to do both good and evil he can both work for and against God. Furthermore, if man can work for God of his own ability than he is equal in ability with God. Therefore, it must be understood that man can work evil in his own ability, but he can work good only by quickening of God’s Spirit in him. God as the prime mover is the only one to act in pure goodness in and of himself.
Did God create evil?
It would seem that the highest good, God, is the cause of evil. Introduction to St. Thomas Aquinas, pg 274
Isaiah 14:5, 7 “I am the Lord, and there is no other God, forming light, and creating darkness, making peace, and creating evil.”
Amos 3:6 “Shall there be evil in a city, which the Lord hath not done?”