وَلَقَد هَمَّت بِهِ ۖ وَهَمَّ بِها لَولا أَن رَأىٰ بُرهانَ رَبِّهِ ۚ كَذٰلِكَ لِنَصرِفَ عَنهُ السّوءَ وَالفَحشاءَ ۚ إِنَّهُ مِن عِبادِنَا المُخلَصينَ
And she certainly determined [to seduce] him, and he would have inclined to her had he not seen the proof of his Lord. And thus [it was] that We should avert from him evil and immorality. Indeed, he was of Our chosen servants.