Assalamu alaikum. If Allah loves for His servants to obey Him, why does He will that some of His servants disobey? Is this a contradiction?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Allah Almighty willed the existence of those who disobey Him and He decreed that by His universal Will and Predestination Will. He also predestined the existence of those who disbelieve in Him, Glory be to Him, and He has great wisdom in that.
Among His Wisdom is that the traces of his Names and Attributes become manifest, for He is severe in penalty, Exalted in Might, and Owner of Retribution.
Therefore, those who violate (His Sharee’ah) must exist so that the effects of his Beautiful Names would appear in them, Blessed and Exalted be He.
Among His Wisdom as well is the occurrence of types of worship that would not exist without the presence of these violators. Allah loves these types of acts of worship and He is pleased with them (these acts). If there were no disobedient people, there would be no need for calling to Allah, enjoining good, forbidding evil and being patient for Allah’s Sake, performing Jihaad against the enemies of Allah, and other types of worship whose benefit in their existence is many times greater than the disadvantage arising from the existence of these disobedient people and violators. Among this wisdom also is for the believers to know the extent of Allah’s Blessing on them, so that they will strive to thank and praise Him with what befits His Majesty, and fulfill the obligation of worshipping Him as He guided them while He misguided others, and He enabled them (to perform acts of worship) while he did not enable others. So, if a rational person were to contemplate these examples and others, he would know why Allah has created the disobedient, the disbelievers, and the violators of the Sharee’ah.
For more benefit on the wisdom for which Allah tests the people, please refer to Fatwa 384328.
Allah knows best.
You can search for fatwa through many choices