Muhammad, cancel my oath of allegiance. But Messenger of Allah ﷺ 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 Messenger of Allah ﷺ said: Medina is like a furnace which drives away its impurity and purifies what is good.
أَنَّ أَعْرَابِيًّا بَايَعَ رَسُولَ اللَّهِ ﷺ فَأَصَابَ الأَعْرَابِيَّ وَعَكٌ بِالْمَدِينَةِ فَأَتَى النَّبِيَّ ﷺ فَقَالَ يَا مُحَمَّدُ أَقِلْنِي بَيْعَتِي فَأَبَى رَسُولُ اللَّهِ ﷺ ثُمَّ جَاءَهُ فَقَالَ أَقِلْنِي بَيْعَتِي فَأَبَى ثُمَّ جَاءَهُ فَقَالَ أَقِلْنِي بَيْعَتِي فَأَبَى فَخَرَجَ الأَعْرَابِيُّ فَقَالَ رَسُولُ اللَّهِ ﷺ إِنَّمَا الْمَدِينَةُ كَالْكِيرِ تَنْفِي خَبَثَهَا وَيَنْصَعُ طَيِّبُهَا