If God is a perfect entity, how can He create something that has the capacity for imperfection?
One of the questions of the ages. I really wish I had a definitive asnwer or a response here. But this is one of those real difficult ones that we have to take with at least a measure of faith. Over the years, as a Christian, I have grown in understanding of the nature of God, and His Word (The Bible) Faith is like that, you can build upon it, and it gets stronger. But at some point we have to admit that we have only a finite understanding of what is going on in the universe, and God sees things with a different viewpoint than we do.
That in itself is easy to understand, everyone sees things from their own viewpoint. Just look at all the dicussions in these posts.
But to take things from God's perspective, now that is a tough one.
So we accept some things on faith, just because God says it is so. And we trust Him because He has proven Himself to us to be complety trustworthy, and faithful to us.
The point is that there is something in the nature of God, that allowed evil to happen in His perfect creation. The Bible is clear that God didn't create this evil, His highest creation, Lucifier did.
How that happened, and how it was possible, I just do not know. I speculate that it has something to do with the nature of love, and free choice. I can even lay it out step by step. But until I get a chance to ask God myself about it, or I am given more understanding about it, I cannot give you the solid answer.
Like I said, this is one of the questions of the ages and has been a stumbling block for people to accept, or even considering accepting the existance of God. But then again, God wants us to take a step of faith towards Him. It has always been that way.