Abu Sa'id Al-Khudri (May Allah be pleased with him) reported:
Prophet of Allah (ﷺ) said: "There was a man from among a nation before you who killed ninety-nine people and then made an inquiry about the most learned person on the earth. He was directed to a monk. He came to him and told him that he had killed ninety-nine people and asked him if there was any chance for his repentance to be accepted. He replied in the negative and the man killed him also completing one hundred. He then asked about the most learned man in the earth. He was directed to a scholar. He told him that he had killed one hundred people and asked him if there was any chance for his repentance to be accepted. He replied in the affirmative and asked, 'Who stands between you and repentance? Go to such and such land; there (you will find) people devoted to prayer and worship of Allah, join them in worship, and do not come back to your land because it is an evil place.' So he went away and hardly had he covered half the distance when death overtook him; and there was a dispute between the angels of mercy and the angels of torment. The angels of mercy pleaded, 'This man has come with a repenting heart to Allah,' and the angels of punishment argued, 'He never did a virtuous deed in his life.' Then there appeared another angel in the form of a human being and the contending angels agreed to make him arbiter between them. He said, 'Measure the distance between the two lands. He will be considered belonging to the land to which he is nearer.' They measured and found him closer to the land (land of piety) where he intended to go, and so the angels of mercy collected his soul".[Al-Bukhari and Muslim].In another version: "He was found to be nearer to the locality of the pious by a cubit and was thus included among them". Another version says: "Allah commanded (the land which he wanted to leave) to move away and commanded the other land (his destination) to draw nearer and then He said: "Now measure the distance between them.' It was found that he was nearer to his goal by a hand's span and was thus forgiven". It is also narrated that he drew closer by a slight movement on his chest.
Arabic/English book reference: Book 1, Hadith 20