In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
The student of knowledge should avoid places [or situations] that will cast doubt [in people’s hearts about] him, his sense of honour and manners. May Allaah have mercy upon the person who avoids [that which will lead others to] backbite him. And when it is the case that whilst Allaah’s Messenger [sallal laahu alayhi wasallam] – the purest human being – was with his wife, he said to two Ansaari men, “Indeed, it is Safiyyah” [i.e. to confirm to them that the woman accompaying him is Safiyyah – his wife], then what about others? [Ref 1]
Therefore, do not be too sure whilst saying, “Indeed, the people will not think anything [evil]”. Even if the people consider you to be upon such a [pious] state, shaytaan can cast evil in their hearts until they accuse you of something you are innocent of. Therefore, avoid places [or situations that will cast] doubt [in the hearts of the people about you], so that you are saved from attracting doubt. [End of Quote]
Ref 1: Question: Why did Allaah’s Messenger (sallal laahu alayhi wasallam) confirm to the two men that it was Safiyyah (radiyallaahu anhaa)? Answer: Narrated Ali Bin Al-Husayn (on the authority of Safiyyah, the Prophet’s wife): The wives of the Prophet (sallal laahu alayhi wasallam) were with him in the masjid (while he was in I’tikaaf) and then they departed, and the Prophet (sallal laahu alayhi wasallam) said to Safiyyah Bint Huyai, “Don’t hurry, for I shall accompany you,” (and her dwelling was in the house of Usaama). The Prophet (sallal laahu alayhi wasallam) went out and in the meantime two Ansaari men met him and they looked at the Prophet (sallal laahu alayhi wasallam) and passed by. The Prophet (sallal laahu alayhi wasallam) said to them, “Come here. She is (my wife) Safiyyah Bint Huyai.” They replied, “SubhaanAllaah, (how dare we think of evil) O Allaah’s Messenger! (i.e. we never expect anything evil from you).” The Prophet (sallal laahu alayhi wasallam) replied, “Satan circulates in the human being as blood circulates in the body, and I was afraid lest Satan might insert an evil thought in your minds.” [Saheeh Al-Bukhaari. Number 2038]
An Excerpt from Sharh Hilyati Taalibil Ilm’ page 57. abridged & slightly paraphrased