And concerning Solomon, the Exalted says: “He said, ‘My Lord, forgive me and grant me a dominion such as will not befit anyone after me. Truly, You are the Bestower.’” (1)
As for Joseph the Truthful, Allah never ascribes any sin to him; for that reason He does not relate from him any plea for forgiveness that would correspond to a sin. Rather, He says: “Thus did We turn away from him evil and lewdness; surely he was one of Our devoted servants.” (2) This informs us that Allah diverted evil and lewdness from him, which in turn shows that no evil or lewdness ever issued from him.
With respect to His statement, “She certainly desired him, and he would have desired her had he not seen the proof of his Lord” (3), the word ham (resolve) is a generic term that comprises two kinds. Imam Ahmad said, “Resolve is of two sorts: a passing thought and a settled determination.” It is affirmed in the Ṣaḥīḥ that the Prophet—peace and blessings be upon him—said: “When a servant intends a sin, it is not recorded against him; if he leaves it, it is recorded for him as one good deed. If he commits it, it is written as one sin; and if he abandons it for any reason other than for Allah, nothing is written for him either way.”
Joseph, upon him be peace, had a resolve that he abandoned for Allah’s sake; therefore Allah turned evil and lewdness away from him because of his sincerity. Such turning occurs only when the motive for the sin—the resolve—is present, yet sincerity intervenes and causes the heart to turn from the sin for Allah’s sake. Hence nothing issued from Joseph except a meritorious act for which he is rewarded. Allah the Most High says: “Indeed, those who are mindful—when a visitation from Satan touches them, they remember, and then they see clearly.” (4)
[The author] then says: “From this the answer becomes clear to the specious argument of those who claim that Allah does not send a prophet unless he was already infallible before prophethood—as a faction of the Rāfiḍīs and others maintain—or that He sends no prophet unless he was already a believer before prophethood. Such people imagine that sins necessarily abase a person even after sincere repentance; this is the root of their error. Whoever thinks that one who has sinned but then makes genuine repentance remains deficient is gravely mistaken, for the blame and punishment that attach to the people of sin do not attach in any way to the one who has repented. If he hastens to repent, nothing at all befalls him; but if he delays repentance, he may be touched by whatever lies between the sins…"