حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا عَبْدُ الْعَزِيزِ، - يَعْنِي الدَّرَاوَرْدِيَّ - عَنِ الْعَلاَءِ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ يَأْتِي عَلَى النَّاسِ زَمَانٌ يَدْعُو الرَّجُلُ ابْنَ عَمِّهِ وَقَرِيبَهُ هَلُمَّ إِلَى الرَّخَاءِ هَلُمَّ إِلَى الرَّخَاءِ وَالْمَدِينَةُ خَيْرٌ لَهُمْ لَوْ كَانُوا يَعْلَمُونَ وَالَّذِي نَفْسِي بِيَدِهِ لاَ يَخْرُجُ مِنْهُمْ أَحَدٌ رَغْبَةً عَنْهَا إِلاَّ أَخْلَفَ اللَّهُ فِيهَا خَيْرًا مِنْهُ أَلاَ إِنَّ الْمَدِينَةَ كَالْكِيرِ تُخْرِجُ الْخَبِيثَ ‏.‏ لاَ تَقُومُ السَّاعَةُ حَتَّى تَنْفِيَ الْمَدِينَةُ شِرَارَهَا كَمَا يَنْفِي الْكِيرُ خَبَثَ الْحَدِيدِ ‏"‏ ‏.‏
Translation
Jabir b. `Abdullah (Allah be pleased with them) reported that a desert Arab swore allegiance to Allah's Messenger (ﷺ). He suffered from a severe fever in Medina (and) so he came to Allah's Messenger (ﷺ) saying

Muhammad, cancel my oath of allegiance. But Allah's Messenger (ﷺ) refused it. He again came and said: Cancel my oath of allegiance. But he (the Holy Prophet) refused it. He again came to him and said: Cancel my oath of allegiance, but he refused. The desert Arab, however, went away (cancelling the allegiance himself). Thereupon Allah's Messenger (ﷺ) said: Medina is like a furnace which drives away its impurity and purifies what is good.