The problem of evil is one as old as religion itself. The concern addressed by the problem may be formulated as follows: “If God is benevolent and all-powerful, then why does evil exist?” I was most fortunate to attend a lecture on Avicenna's response to this question, as I feel, his solution is one of the most comprehensive.
Though I could never do the master justice, I will briefly summarize Avicenna's point. First, from his metaphysics, we know that God is immaterial while humans are enmattered. Matter lives in the realm of potentiality and is therefore capable of changing, God on the other hand is incapable of change and thus remains constant. Evil is a deficiency or deformity of some sort, its presence is predicated on a lack of goodness. Evil therefore, is only possible in matter.
Another thing one should know about Avicenna's God is that God does not know human individuals directly, as individuals are made from matter. Instead, He knows us through our universal (immaterial) essence, that which makes us human. Evil, in contrast, only occurs in individuals, an evil cannot be committed against the species (which is an immaterial concept) even if an evil is brought upon every member of said species.
A world without evil, would necessarily be one without matter, without lack and without potential. In other words, this would be the world of God, heaven if you will. The world would be constant and never changing, not an attractive prospect. Avicenna therefore claims evil to be necessary and furthermore, that the existence of evil is in fact good.
This system leads to the somewhat strange conclusion that God does not know Evil. Of course He knows the universals, and as such knows evil in an abstract way, but He has certainly never experienced evil. Some Christian doctrines of the holy trinity stand in opposition to this idea, where the father and the son are the same being, but that discussion is far too large for this post to delve into.
The question that remains, at least in my mind, is why God would punish evil if he doesn't even know it. This question is however quite easy to answer, He doesn't. The more I learn about Abrahamic religions, the more it seems like Hell is not actually a punishment for the wicked. Instead, hell is the natural result of a sinful or evil life, whereas heaven is the result of a good one. This is similar to Dante's doctrine as described in the divine comedy. In this work, Dante travels through the afterlife and meets many creatures stuck in hell. This is however, a hell of their own making, they have associated their sinful behaviour in life with their essence, thus remaining stuck in habits preventing enlightenment.
It stands to reason that God is sad about this (insofar as He can be) because he does seem to care about humanity. We humans are characterized by a lack, a lack God can fill. His attempts do so come in the form of prophets teaching us how to reach heaven.