Muhammad ibn Ka‘b al-Qurazi said: When Joseph desired her, he raised his head toward the ceiling of the house and saw writing on its wall: “And do not approach unlawful sexual intercourse. Indeed, it is ever an immorality and is evil as a way.”
Atiyyah narrated from Ibn Abbas, concerning the proof, that he saw the image of an angel. (1)
Ja‘far ibn Muhammad al-Sadiq, may Allah have mercy on him, said: “The proof was the prophethood that Allah had placed within his breast, which kept him from that which incurs Allah’s displeasure.” (2)
Ali ibn al-Husayn related: There was an idol in the house, so the woman rose and covered it with a garment. Joseph asked her, “Why did you do this?”
She replied, “I felt ashamed before it that it should see me committing a sin.”
Joseph said, “Are you ashamed before that which neither hears, nor sees, nor understands? I have greater reason to be ashamed before my Lord.” Then he fled. (3)
(1) For the source documentation of these reports, see al-Durr al-Manthur, 4:521-524.
(2) Close to this view is the opinion of those who said that the proof was Yusuf's knowledge of what Allah had made lawful and unlawful; thus, he saw the prohibition of zina (fornication). This was reported from Muhammad ibn Kab al-Qurazi. Ibn Qutaybah said: “He saw Allah’s proof against him, and that was the proof.” Ibn al-Jawzi stated in Zad al-Masir, 4:209: “This is the correct view; what preceded it is of no value. Rather, they are reports fabricated by popular storytellers. I have pointed out their falsehood in al-Mughni fi al-Tafsir. How could one suppose that a noble prophet of Allah would need to be frightened, terrified, and compelled to abandon this sin while persisting in it? This is utterly repugnant.”
(3) After citing those conflicting and inconsistent reports, Imam Ibn Jarir al-Tabari said in his Tafsir, 16:49: “The soundest view is to say that Allah, exalted be His praise, informed us that Yusuf and the wife of al-Aziz each entertained an intention concerning the other, had Yusuf not seen the proof of his Lord. This was one of Allah’s signs, which restrained him from committing the indecency he had contemplated. That sign may have been an image of Yaqub; it may have been an image of an angel; or it may have been the warning contained in the Quranic verses in which Allah mentions zina. There is no decisive evidence favoring any one of these possibilities over another. What is correct is to say only what Allah has said, to believe in it, and to leave the rest to the One who knows it.”
Shaykh al-Shanqiti said in Adwa al-Bayan, 3:68: “The statements attributed to these scholars fall into two categories. The first consists of reports whose attribution to those from whom they are related has not been established through an authentic chain; there is no difficulty in dismissing these. The second consists of reports authentically established from some of those mentioned. As for those from whom something of this has been authentically reported, the apparent and overwhelmingly probable conclusion, bordering on certainty, is that they received it from Israiliyyat (Israelite narratives), for there is no scope for personal opinion in such matters, and none of it, whether little or much, has been transmitted back to the Prophet, peace and blessings be upon him. Thus, one should not dare assert that the Prophet Yusuf sat between the legs of an unrelated unbelieving woman, intending to commit zina with her, on the basis of such reports. Some of these reports bear evident marks of fabrication, such as the story of the hand that appeared to him four times, which he ignored on three occasions. Even if this were assumed to be authentic, it would be a most powerful deterrent for the common sinful people; so what then of the finest of the prophets? Moreover, we have already presented the Quranic evidence establishing his innocence from several angles and explained that the reality is limited to one of two possibilities: either he did not entertain any intention toward her at all, since his intention was made conditional upon not seeing the proof, whereas he did see the proof; or his intention was the natural inclination restrained by piety. And Allah knows best.”