Imam Yahya an-Nawawi was a great scholar who reached a high level in knowledge, asceticism and ordering good and eradicating evil.
Shaikh Jamaal Zarabozo, in his excellent “Commentary on Forty Hadith of al-Nawawi”, mentions few incidents in which al-Nawawi excelled in ordering good and eradicating evil. What follows is one of them:
“Sultan al-Dhaahir Baibars understood the dangers of the Mongols close by. Hence, he decided to do what he could to defeat them and drive them further out of the lands of the Muslims. He asked for a fatwa from the scholars that would allow him to take money from the citizenry in order to use it in his battles against the Mongols. The scholars of al-Shaam wrote such a fatwa for him. He asked if any scholar refused to write such a letter and he was told that only al-Nawawi refused. Al-Dhaahir Baibars had al-Nawawi brought to him and he asked him personally to sign with the other scholars. However, al-Nawawi refused. The Sultan asked him why. He answered,
I know that you used to be a slave of the Ameer Banduqaar and you did not have any wealth. Then Allah bestowed his bounty upon you and you became the ruler. I have heard that you have one thousand male slaves and each one of them has a girth [by which the horse’s saddle is tied] of gold. And you have two hundred slave girls and each of them has a portion of gold jewelry. If you spend all of that and you leave your slaves with straps and dyes instead of the gold girths, and you leave the slaves girls with their clothing and no jewelry, then I will give you a fatwa that you can take wealth from the citizenry.
Here, once again it is narrated that the Sultan got upset with him and had him banished from Damascus. He then left to Nawa. Perhaps, there was more than one event that led to the Sultan’s actual decision to ban al-Nawawi from Damascus, Allah knows best.
After he left to Nawa, the scholars said that he was one of their leading scholars and workers. He is someone whose example is to be followed. Hence, they went to try to bring him back to Damascus. However, he refused. He said that he would not enter Damascus if al-Dhaahir was still there. After a few months, Sultan al-Dhaahir Baibars died.”
[End quote from the Commentary on Forty Hadith of al-Nawawi]