[Machine] The Messenger of Allah ﷺ said, "Remember the good qualities of your deceased and refrain from mentioning their faults." The scholar (may Allah have mercy on him) said, "It has been narrated in a hadith from Ma'mar on the authority of Thabit, who reported from Anas, that he said: A funeral procession passed by the Prophet ﷺ and he said, "Speak well of him." So they spoke well of him. Another procession passed by and he said, "Speak ill of him." So they spoke ill of him. There is evidence in this hadith that they only praised one funeral and criticized the other when the Prophet ﷺ commanded them to praise them. And there is evidence that it is permissible to mention what is known about a person when there is a need for it, such as asking a judge or something similar to that. It is as if those who spoke ill of him were proclaiming his evil and the Prophet ﷺ wanted to deter people like him from their evil deeds and from indulging in idle talk. So he said, "What did he say? Allah knows best."
قَالَ رَسُولُ اللهِ ﷺ اذْكُرُوا مَحَاسِنَ مَوْتَاكُمْ وَكُفُّوا عَنْ مَسَاوِئِهِمْ قَالَ الشَّيْخُ رَحِمَهُ اللهُ قَدْ رُوِّينَا فِي حَدِيثِ مَعْمَرٍ عَنْ ثَابِتٍ عَنْ أَنَسٍ أَنَّهُ قَالَ مُرَّ بِجِنَازَةٍ عَلَى النَّبِيِّ ﷺ فَقَالَ أَثْنُوا عَلَيْهِ فَأَثْنَوْا خَيْرًا وَمُرَّ بِأُخْرَى فَقَالَ أَثْنُوا عَلَيْهِ فَأَثْنَوْا شَرًّا وَفِيهِ دَلَالَةٌ عَلَى أَنَّهُمْ إِنَّمَا أَثْنَوْا عَلَى الْجِنَازَتَيْنِ عَلَى إِحْدَاهُمَا بِالْخَيْرِ وَعَلَى الْأُخْرَى بِالشَّرِّ عِنْدَ أَمْرِ النَّبِيِّ ﷺ بِالثَّنَاءِ عَلَيْهِمَا وَفِيهِ دَلَالَةٌ عَلَى جَوَازِ ذِكْرِ الْمَرْءِ بِمَا يَعْلَمُهُ مِنْهُ إِذَا وَقَعَتِ الْحَاجَةُ إِلَيْهِ نَحْوَ سُؤَالِ الْقَاضِي الْمُزَكِّي وَمَا أَشْبَهَ ذَلِكَ وَكَأَنَّ الَّذِي أَثْنَوْا عَلَيْهِ شَرًّا كَانَ مُعْلِنًا بَشَرِّهِ فَأَرَادَ النَّبِيُّ ﷺ زَجْرَ أَمْثَالِهِ عَنْ شُرُورِهِمْ وَعَنْ إِطَالَةِ الْأَلْسِنَةِ فِي أَنْفُسِهِمْ فَقَالَ مَا قَالَ وَاللهُ أَعْلَمُ