He said: "O my Lord! Prison is more to my liking than that to which they invite me. Unless You turn away their plot from me, I will feel inclined towards them and be one (of those who commit sin and deserve blame or those who do deeds) of the ignorants."
So his Lord answered his invocation and turned away from him their plot. Verily, He is the All-Hearer, the AllKnower. Surah 12: 33-34
That evening, Zulaikha convinced her husband that the only way to save her honor was to put Joseph in prison; otherwise she would not be able to control herself or to safeguard his prestige. The chief minister knew Joseph was absolutely innocent, that he was a young man of honor, a loyal servant, and he loved him for these reasons. It was not an easy decision for him to put an innocent man behind bars. However, he was left with no choice. He reasoned that Joseph's honor would also be safeguarded if he was kept out of Zulaikha's sight. That night, with a heavy heart, the chief minister sent Joseph to prison.
Related Quran Ayaaths of this Hadith.
Surah 6 : Ayah 84 Surah 12 : Ayah 96 Surah 12 : Ayah 99 Surah 12 : Ayah 100 Surah 12 : Ayah 102 Surah 12 : Ayah 111"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari