An Arabi pledged allegiance to the Messenger of Allah ﷺ for Islam, then was struck by a fever in Madinah. The Arabi came to the Messenger of Allah ﷺ and said, "Release me from my pledge."The Messenger of Allah ﷺ refused. The Arabi left, then returned and said, "Release me from my pledge."He refused again. The Arabi left, and the Messenger of Allah ﷺ said, "Madinah is like a bellows. It expels its impurities and refines what is pure within it."
حدثنا الأنصاري حدثنا معن حدثنا مالك بن أنس ح و حدثنا قتيبة عن مالك بن أنس عن محمد بن المنكدر
أن أعرابيا بايع رسول الله ﷺ على الإسلام فأصابه وعك بالمدينة فجاء الأعرابي إلى رسول الله ﷺ فقال أقلني بيعتي فأبى رسول الله ﷺ فخرج الأعرابي ثم جاءه فقال أقلني بيعتي فأبى فخرج الأعرابي فقال رسول الله ﷺ إنما المدينة كالكير تنفي خبثها وتنصع طيبها
Agreed upon [by Bukhari and Muslim]. Bukhari narrated it in the Book of Rulings, chapter "One who gives allegiance then withdraws his allegiance," hadith no. 7211, and Muslim, hadith no. 1383, from the hadith of Malik with this wording, and it is found in Muwatta 2/886 (Yahya). There is also a narration on this subject from Abu Hurairah [Bukhari, hadith no. 1871, and Muslim, hadith nos. 1381, 1382].