53. “Yet I do not claim to be innocent. The soul commands evil, except those on whom my Lord has mercy. Truly my Lord is Forgiving and Merciful.” 54. The king said, “Bring him to me, and I will reserve him for myself.” And when he spoke to him, he said, “This day you are with us established and secure.”
When Joseph was presented to the king, he did not claim to be innocent but took on the punishment that he was given. This is how we know that he knows that he played a part in the incident with the king's wife. He says himself that the soul wants to do evil but god is the one stops the evil from happening. And so he was forgiven by the king to work along side him. (Itani, T. (n.d.). Quran in English - Clear and Easy to Read. Quran in English. https://www.clearquran.com/012.html) CC BY-NC