The Prophet of Allah ﷺ said, "Among those who came before you, there was a man who had killed ninety-nine people. He asked about the most knowledgeable person on earth and was directed to a monk. He went to him and said that he had killed ninety-nine people, was there any repentance for him?The monk replied, 'No.'So he killed him too, completing one hundred. Then he asked again about the most knowledgeable person on earth and was directed to a learned man. He said to him that he had killed one hundred people, was there any repentance for him?The man replied, 'Yes, who could stand between you and repentance? Travel to such-and-such land, for there are people there who worship Allah. Worship Allah along with them, and do not return to your own land, for it is a wicked land.'So he set out, but when he had reached the halfway point, death overtook him. The angels of mercy and the angels of punishment disputed over him, the angels of punishment saying that he had never done any good deed. Then an angel came to them in the form of a human being, and they accepted him as arbitrator between them.He said, 'Measure the distance between the two lands. Whichever he was nearer to, he belongs to it.'They measured and found him to be nearer to the land he had been heading toward, so the angels of mercy took his soul."
أن نبي الله ﷺ قال: كان فيمن كان قبلكم رجل قتل تسعة وتسعين نفسا، فسأل عن أعلم أهل الأرض فدل على راهب، فأتاه فقال: إنه قتل تسعة وتسعين نفسا، فهل له من توبا؟ فقال: لا، فقتله، فكمل به مائة، ثم سأل عن أهل الأرض فدل على رجل عالم، فقال: إنه قتل مائة نفس، فهل له من توبة؟ فقال: نعم، ومن يحول بينه وبين التوبة؟ انطلق إلى أرض كذا وكذا. فإن بها أناسا يعبدون الله فاعبد الله معهم، ولا ترجع إلى أرضك؛ فإنها أرض سوء، فانطلق حتى إذا نصف الطريق فأتاه الموت، فاختصمت فيه ملائكة الرحمة وملائكة العذاب: إنه لم يعمل خيرا قط. فأتاهم ملك في صورة آدمي، فجلعوه بينهم. فقال: قيسوا ما بين الأرضين، فإلى أيتهما كان أدنى، فهو له، فقاسوه فوجدوه أدنى إلى الأرض التي أراد، فقبضته ملائكة الرحمة.
Bukhari reported it in the chapters on the prophets (3470), and Muslim reported it in the book of repentance (2766-46), both through the route of Qatada, from Abu Siddiq Naji, from Abu Saeed Khudri, and he mentioned it. This wording is that of Muslim. In the wording of Bukhari it reads, "There was among Banu Israil...", with an addition after his saying, "then death overtook him," namely, "so he turned his chest toward it." He also added his saying, "So Allah revealed to this one, 'Draw near,' and Allah revealed to this one, 'Draw away,'" and he said, "So he was found closer to this one by a handspan, and he was forgiven." In the wording of Muslim, it reads, "So he was closer to the righteous village by a handspan, and he was made one of its people."