To see the answer click the link given below and read the following explanation. Is it Allah (SWT) Who creates evil too?
As eternal benevolence and pre-eternal wisdom necessitated, the Pre-Eternally All-Wise One created this world to be a place of trial, an arena of examination, a mirror to His Most Beautiful Names, and a page for the pen of Divine Determining and Power. Now, trial and examination are the cause of growth and development. And growth causes the disposition to unfold. And this unfolding causes the abilities to become apparent. And this emergence of the abilities causes the relative truths to become evident. And the relative truths’ becoming evident causes the embroideries of the manifestations of the All-Glorious Maker’s Most Beautiful Names to be displayed, and the universe to be transformed into a missive of the Eternally Besought One. It is through this mystery of examination and the mystery of man’s being charged with certain duties that the diamond-like essences of elevated spirits are purified of the coal-like matter of base spirits, and the two separated from one another.Thus, since it was for mysteries such as these, and for other most subtle and elevated instances of wisdom which we do not yet know of that the Pre-Eternally All-Wise One willed the world in this form, He also willed the change and transformation of this world for those instances of wisdom. He mixed together opposites for its change and transformation, and brought them face to face. Combining harm with benefit, including evil with good, and mingling ugliness with beauty, He kneaded them together like dough, and made the universe subject to the law of change and mutation, and the principle of transformation and perfection.
A day will come when this assembly of examination is closed, and the period of trial is finished, and the Divine Names have carried out their decree, and the pen of Divine Determining has completed writing its missives, and Divine Power completed the embroideries of its art, and beings have fulfilled their duties, and creatures accomplished their acts of service, and everything has stated its meaning, and this world produced the seedlings of the Hereafter, and the Earth has displayed and exhibited all the miracles of power of the All-Powerful Maker, and all the wonders of His art, and this transient world has attached to the string of time the tableaux forming the panoramas of eternity.For the eternal wisdom and pre-eternal beneficence of the All-Glorious Maker necessitate truths like the results of the examination and trial, the truths of those Divine Names’ manifestations, the truths of the missives of the pen of Divine Determining, the originals of those sample-like embroideries of art, the aims and benefits of the duties of beings, the wages of the acts of service of creatures, the truths of the meanings the Book of the Universe stated, the sprouting of the seeds of innate disposition, the opening of a Supreme Court of Judgement, the displaying of the sample-like panoramas taken from this world, the rending of the veil of apparent causes, and the surrendering of everything directly to the All-Glorious Creator. And since the All-Glorious Maker’s pre-eternal wisdom and beneficence necessitate these truths, they require the purification of those opposites in order to deliver the world from change and transience, transformation and extinction, and to separate out the causes of change and the matters of conflict. And most certainly they will bring about the Resurrection and purify those opposites in order to obtain these results.
Thus, as a result of this purification Hell will take on its eternal and dreadful form, and its inmates will manifest the threat:
And get you apart this day, Oh you sinners!
And Paradise will assume its everlasting and majestic form, and its people and companions will manifest the address:
Peace be upon you! Well have you done! Enter here to dwell for ever.
Also article given below enlightens another aspect of the question;
Why are devils created? Almighty God created Satan and evils; what is the wisdom in it? Isn’t the creation of evil, evil, and the creation of bad, bad?
T h e A n s w e r : God forbid, the creation of evil is not evil, the desire for or inclination towards evil, rather, is evil. For creation and bringing into existence look to all the consequences, whereas such desire looks to a particular result, since it is a particular relation. For example, there are thousands of consequences of rain falling, and all of them are good. If through ill choice, some people receive harm from the rain, they cannot say that the creation of rain is not mercy, they cannot state that the creation of rain is evil. Rather, it is due to their ill choice and inclination that it is evil for them. Also, there are numerous benefits in the creation of fire, and all of them are good. But if some people receive harm from fire through their misuse of it and their wrong choice, they cannot say that the creation of fire is evil, because it was not only created to burn them. Rather, they thrust their hands into the fire while cooking the food through ill choice, and made that servant inimical to themselves.
In Short: The lesser evil is acceptable for the greater good. If an evil which will lead to a greater good is abandoned so that a lesser evil should not be, a greater evil will then have been perpetrated. For example, there are certainly some minor material and physical harms and evils in sending soldiers to fight a jihad, but in the jihad is a greater good whereby Islam is saved from being conquered by infidels. If the jihad is abandoned due to those lesser evils, then the greater evil will come after the greater good has gone. And that is absolute wrong. And for example, to amputate a finger which is infected with gangrene and has to be amputated is good and right, although it is apparently an evil. For if it is not amputated, the hand will be amputated, and that would be a greater evil.
Thus, the creation and bringing into existence of evils, harms, tribulations, satans, and harmful things, is not evil and bad, for they are created for many important results. For example, satans have not been set to pester the angels, and the angels cannot progress; their degrees are fixed and deficient. However, in the world of humanity the degrees of progress and decline are infinite. There is an extremely long distance through which to progress, from the Nimrod’s and Pharaoh’s as far as the veracious saints and the prophets.
Thus, through the creation of satans and the mystery of man’s responsibility and the sending of prophets, an arena of trial and examination and striving and competition has been opened so that coal-like base spirits may be differentiated and separated out from diamond-like elevated spirits. If there had been no striving and competition, the potentialities in the mine of humanity which are like diamonds and coal would have remained equal. The spirit of Abu Bakr the Veracious at the highest of the high would have remained on the same level as that of Abu Jahl at the lowest of the law. This means that since the creation of satans and evils looks to great and universal results, their being brought into existence is not evil or bad. The evils and instances of bad that arise from abuses and the particular causes known as inclination or choice pertain to man’s choice, not to Divine creation.
If you ask? The majority of humanity become unbelievers due to the existence of Satan and embrace unbelief and suffer harm, despite the sending of prophets: If, according to the rule, “the majority has the word,” the majority suffers evil as a result, then the creation of evil is evil, and it may even be said that the sending of prophets is not a mercy. Is that not so?
The Answer: Quantity has no importance in relation to quality. The true majority looks to quality. For example, if. there are a hundred seeds of the date-palm and they are not put beneath the earth and watered and so do not undergo a chemical reaction and manifest a struggle for life, they are only a hundred seeds worth virtually nothing. But If they are watered and are subject to the struggle for life, and then eighty out of the hundred rot due to their faulty make-up, but twenty become fruit-bearing trees, can you say, “watering them was evil because most of them ratted?” Of course, you cannot say that, for that twenty have become like twenty thousand. One who loses eighty and gains twenty thousand suffers no harm and it cannot be evil.
And for example, if a peahen lays one hundred eggs, and they are worth five hundred kurush. If the hen sits on the hundred eggs and eighty are spoilt and twenty hatch into peacocks, can it be said that there was a high loss and the affair was evil; that it was bad to put the broody hen on the eggs and an evil occurred? No, it is not thus, it is rather a good. For the peacock species and egg family lost eighty eggs worth four hundred kurush, but gained twenty peacocks worth eighty liras.
Thus, through the sending of prophets and the mystery of man’s responsibility, and through striving, and fighting with satans, in return for the hundreds of thousands of prophets and millions of saints and thousands of millions of purified scholars they have gained, who are like the suns, moons, and stars of the world of humanity mankind has lost the unbelievers and dissemblers, who are numerous in regard to quantity, insignificant in regard to quantity, and like harmful beasts.