Mishkat al-Masabih 766
وَعَن أبي سعيد الْخُدْرِيّ قَالَ: بَيْنَمَا رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يُصَلِّي بِأَصْحَابِهِ إِذْ خلع نَعْلَيْه فَوَضَعَهُمَا عَنْ يَسَارِهِ فَلَمَّا رَأَى ذَلِكَ الْقَوْمُ أَلْقَوْا نِعَالَهُمْ فَلَمَّا قَضَى رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ صَلَاتَهُ قَالَ: «مَا حَمَلَكُمْ على إلقائكم نعالكم؟» قَالُوا: رَأَيْنَاك ألقيت نعليك فَأَلْقَيْنَا نِعَالَنَا. فَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِنْ جِبْرِيلَ أَتَانِي فَأَخْبَرَنِي أَنَّ فيهمَا قذرا إِذا جَاءَ أحدكُم إِلَى الْمَسْجِدَ فَلْيَنْظُرْ فَإِنْ رَأَى فِي نَعْلَيْهِ قَذَرًا أَو أَذَى فَلْيَمْسَحْهُ وَلِيُصَلِّ فِيهِمَا» . رَوَاهُ أَبُو دَاوُدَ وَالدَّارِمِيُّ
And from Abu Saʿid al-Khudri, who said: While the Messenger of Allah ﷺ was leading his Companions in prayer, he took off his sandals and placed them on his left. When the people saw that, they threw off their sandals. When the Messenger of Allah ﷺ finished his prayer, he said: "What made you throw off your sandals?" They said: "We saw you throw off your sandals, so we threw off our sandals." The Messenger of Allah ﷺ said: "Jibril came to me and told me that there was filth on them. When one of you comes to the mosque, let him look, and if he sees filth or something harmful on his sandals, let him wipe it off and pray in them." Reported by Abu Dawud and ad-Darimi.