Narrated Jabir:
A bedouin came to the Prophet and gave a pledge of allegiance for embracing Islam. The next day he came with fever and said (to the Prophet ), “Please cancel my pledge (of embracing Islam and of emigrating to Medina).” The Prophet refused (that request) three times and said, “Medina is like a furnace, it expels out the impurities (bad persons) and selects the good ones and makes them perfect.”
Sahih Bukhari, Volume 3, Book30, Number 107