Answer
Wa `alaykum as-salamu wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Evil in so far they exist in the world is due to the works of humans. Allah has given us the freedom to choose, and when we make wrong choices, we end up suffering.
In his response to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states,
Evil in so far they exist in the world is due to the works of humans. Allah has given us the freedom to choose, and when we make wrong choices, we end up suffering. Sufferings, we have no control over, can be a source of expiation for us.
A believer benefits from both good and bad things that happen to him; he is grateful for the good that happens to him, while perseveres in patience when evil happens to him. Thanks to the way he acts in both situations he stands to gain at the end. We would be rewarded for gratitude as well as for showing patience.
Moreover, we will be compensated for our unavoidable sufferings in the next world.
Lastly, it is equally important for us to recognize that we do not have access to the divine mysteries. Although we may try to understand these issues as best as we can, we should entrust the knowledge of what we do not know the Almighty, who knows it all. This is the meaning of surrender, which is the essence of our faith.
Allah Almighty knows best.