Allah’s ruling is binding upon His slave: it will come to pass, and it is a just ruling, as mentioned in the hadith:
"Your decree concerning me will be carried out, and You are Just with me in Your Ruling."
Allah, the Most High, has forbidden Himself from being unjust with his slaves. Indeed it is people themselves who do wrong and are unjust.
The above-mentioned hadith, "And You are Just with Me in Your Ruling" also includes the decree of sinning, in its effect and its punishment. Allah is the Most Just regarding His decree for sinning and for its punishment. He may have ordained a sin for one of His slaves for reasons that are beyond our grasp. There might be a purpose which, due to its being so profound in its ramifications, is known only to Him. And that is the belief of the Muslim.