Riyad as-Salihin, Book 1, Hadith 20 (In-Book)

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.

وعن أبي سعيد سعد بن مالك بن سنان الخدري رضي الله عنه أن نبي الله صلى الله عليه وسلم قال‏:‏ ‏ "‏ كان فيمن كان قبلكم رجل قتل تسعة وتسعين نفساً، فسأل عن أعلم أهل الأرض، فدل على راهب، فأتاه فقال‏:‏ إنه قتل تسعه وتسعين نفساً، فهل له من توبة‏؟‏ فقال‏:‏ لا، فقتله فكمل به مائةً، ثم سأل عن أعلم أهل الأرض، فدل على رجل عالم فقال‏:‏ إنه قتل مائة نفس فهل له من توبة‏؟‏ فقال‏:‏ نعم، ومن يحول بينه وبين التوبة‏؟‏ انطلق إلى أرض كذا وكذا، فإن بها أناساً يعبدون الله تعالى فاعبد الله معهم، ولا ترجع إلى أرضك فإنها أرض سوءٍ، فانطلق حتى إذا نصف الطريق أتاه الموت، فاختصمت فيه ملائكة الرحمة وملائكة العذاب‏.‏ فقالت ملائكة الرحمة‏:‏ جاء تائبا مقبلا بقلبه إلى الله تعالى، وقالت ملائكة العذاب‏:‏ إنه لم يعمل خيرا قط، فأتاهم ملك في صورة آدمي فجعلوه بينهم- أي حكماً- فقال‏:‏ قيسوا ما بين الأرضين فإلى أيتهما كان أدنى فهو له، فقاسوا فوجدوه أدنى إلى الأرض التي أراد، فقبضته ملائكة الرحمة‏" ‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏‏.‏

sunnah.com