And the man from Egypt who bought him said to his wife: "Make his stay [with us] honourable; he may well be of use to us, or we may adopt him as a son. And thus We gave unto Joseph a firm place on earth; and [We did this] so that We might impart unto him some understanding of the inner meaning of happenings. For, God always prevails in whatever be His purpose: but most people know it not. 21 When he reached the prime of life We gave him wisdom and knowledge. Thus We reward those who are good. 22 And she, in whose house he was, sought to seduce him. She closed the doors and said, "Come, you." He said, "[I seek] the refuge of Allah. Indeed, he is my master, who has made good my residence. Indeed, wrongdoers will not succeed." 23 And she advanced towards him, and had Joseph not perceived a sign from his Lord he too would have advanced towards her. Thus was Joseph shown a sign from his Lord that We might avert from him all evil and indecency, for indeed he was one of Our chosen servants. 24 And they both hastened to the door, and she rent his shirt from behind and they met her husband at the door. She said: What is the punishment of him who intends evil to your wife except imprisonment or a painful chastisement? 25 (Joseph) said: She it was who asked of me an evil act. And a witness of her own folk testified: If his shirt is torn from before, then she speaketh truth and he is of the liars. 26 And if his shirt is torn from behind, then she hath lied and he is of the truthful. 27 So when he (her husband) saw his [(Yusuf's (Joseph)] shirt torn at the back; (her husband) said: "Surely, it is a plot of you women! Certainly mighty is your plot! 28 Joseph, stay away from such affairs and you, woman, ask forgiveness for your sin; the guilt is yours." 29