Whoever reflects on the Quran will see that, in most passages where Allah mentions His creation of disbelief and sins, He presents it as recompense for such conduct. As He, the Exalted, says:
“Whoever Allah wills to guide, He opens his heart to Islam; and whoever He wills to lead astray, He makes his heart tight and constricted, as though he were climbing into the sky. Thus does Allah place defilement upon those who do not believe.”
And He, the Exalted, says:
“When they deviated, Allah caused their hearts to deviate.”
And He, the Exalted, says:
“But as for the one who withholds, considers himself self-sufficient, and denies the best reward, We will ease him toward hardship.”
In these and similar cases, they undertook deeds through which He punished them for committing what was forbidden and neglecting what was commanded. Those deeds proceeded from them and were created in them only because they had not done what they were created to do. Yet they must necessarily act and exercise their will.
When they did not engage in good deeds, they were moved to engage in evil deeds, as an act of justice from Allah. He placed this where it belonged, in a receptacle susceptible to it—the heart, which cannot remain inactive. If it does not engage in good, it is put to work doing evil. As the saying goes: “If you do not keep your soul occupied, it will keep you occupied.”
When properly understood, this explanation cuts off at the root the arguments of both the denialist Qadariyyah and the advocates of compulsion: those who say that people’s deeds are not created by Allah and regard His creating those deeds and punishing people for them as injustice; and those who say that He created the disbelievers’ disbelief and disobedience and punished them for it without any cause or wisdom.