The following Hadith on repentance is narrated in the Hadith collections of both Bukhari and Muslim:
Once there was a man, a long time before, who killed ninety-nine people. One day he began to feel remorse for his actions, and he began to search for the most renowned scholar of the area. He was told that he should go to see a certain priest. When he went to the priest, he told him that he had killed ninety-nine people and asked whether his repentance would be accepted. When the priest said “No,” he killed the priest too. In this way, the number of murders he had committed increased to a hundred.
After this, he was again full of remorse and inquired who the greatest scholar of the time was. A prominent scholar was recommended to him. The man told the scholar that he had killed a hundred people and asked whether his repentance would be accepted. The scholar told him that (of course) he could repent, that no one had the right to stand between a person and his repentance, and told him to go to a certain place where people who worshipped God were living. He told him; “Worship God along with them. Don’t return to your village, because it is an evil place.”
The man set forth, yet he died halfway (through his journey). Upon his death, the angels of punishment and the angels of mercy disagreed about (what to do with) the man. The angels of mercy said: “this man has come here as penitent and has turned to God with his heart,” while the angels of punishment said: “He did not perform any good deeds.”
Meanwhile, an angel in human form appeared. The angels of mercy and the angels of punishment agreed that this angel should judge the disagreement.
The angel in human form said: “Measure the distance from both sides, and compare them. He will belong to whichever side he is closer to.” When they measured the distances and compared them, they saw that he was closer to his destination by the length of a hand, and the angels of mercy took him away.
According to another report, the last part of the hadith is as follows: “After God ordered the former village to recede, and the latter to come nearer, the angel in human form told them to measure the distance from both sides. When they did as they were told, they saw that he was closer to the village of good people by the length of a hand. In this way he was forgiven.