You may wish to cut and past and save the literature on this link and print and read it at your leisure.
I think the answer to your question is under the title "DEEDS"
As Ever Humble
He, the Exalted, the High, there is no existence except Him, unless it occurs by His action and proceeds from His Justice, in the best, perfect, complete and just ways.
He is Wise in His verdicts. His justice is not to be compared with that of worshippers, because it is conceivable that the worshipper is unjust when he deals with properties of other than his own. But, harm is not conceivable from Allah - the High - because He does not encounter any ownership of other than Himself, in which His dealing could be described to be harmful.
Everything besides Him, children of Adam and jinn, angels and devils, heaven and earth, animals, plants, and inanimates, substance and its quality, as well as things perceived and things felt, are all originated things which He created by His Power and before they were nothing, since He existed in Eternity alone and there was nothing whatsoever with Him.
So He originated creation thereafter as a manifestation of His Power and a realization of that which had preceded of His Will and the realization of His Word in eternity, not because He had any need or necessity for it.
He is magnanimous in creating and inventing and in imposing obligations, not doing it through necessity.
He is Gracious in beneficence and reform, though not through any need. Munificence and Kindness, Beneficence and Grace are His, since He is able to bring upon His creatures all manner of torture and to try them with all kinds of pain and affliction. Even if He should do this, it would be justice from Him, it would not be vile, it would not be tyrannous.
He - the Mighty, the Glorified - rewards His believing worshippers for their acts of obedience according to generosity and encouragement rather than according to their merit and obligation. For there is no obligation upon Him in any deed towards anyone and tyranny is inconceivable in Him. For there is no right upon Him towards anyone.
As for His right to be obeyed it is obligatory and binding upon all creatures because He made it obligatory upon them through the tongues of His prophets and not by reason. But He sent His prophets and showed their truthfulness through explicit miracles, and they conveyed His commands and prohibitions as well as His promises and threats. So it became obligatory upon all creatures to believe them and what they brought.