Qur'an, Yusuf, Surah 12:33-34
Joseph turned to his Lord and said, "My Lord, I would rather go to prison than to give in to their lure. Unless You protect me from their wiles, I may yield to their charms and fall from grace." So the Lord heard his prayer and fended off their wiles from him. Indeed He is All-Knowing, All-Aware.