Surah Yusuf, Verse 24
Translation — Sahih International
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.
Source
Kur'an-ı Kerim, Yûsuf Suresi 12:24
https://kuran.diyanet.gov.tr/mushaf/kuran-meal-2/12-suresi-24-ayet