The following is based on a hadith from Sahih Bukhari Volume 4, Book 56, Number 676.
There was a man who had heartlessly murdered ninety-nine people. Then, he felt remorse.
He went to a learned man and told him about his past, explaining that he wished to repent, reform, and become a better person. "I wonder if Allah will pardon me?" he asked.
For all his learning, the scholar was a man who had not been able to digest what he had learned. "You will not be pardoned;' he said. "Then I may as well kill you, too," said the other. And kill him he did.
He then found another worthy individual and told him that he had killed a hundred people. "I wonder," he said, "whether Allah will pardon me if I repent?" Being a truly wise man, he replied, "Of course you will be pardoned; repent at once. I have just one piece of advice for you: avoid the company of wicked people and mix with good people, for bad company leads one into sin:"
The man expressed repentance and regret, weeping as he sincerely implored his Lord to pardon him. Then, turning his back on bad company, he set off to find a neighborhood where righteous people lived.
On the way, his appointed hour arrived, and he died. The angels of punishment and of mercy both came to take away his soul. The angels of punishment said that as a sinful person he rightfully belonged to them, but the angels of mercy also claimed him, saying, "He repented and had resolved to become a good man. He was on his way to a place where righteous people live, but his appointed hour had come." A great debate ensued, and Gabriel was sent as an arbitrator to settle this affair.
After hearing both sides he gave this verdict: "Measure the ground. If the spot where he died is closer to the good people, then he belongs to the angels of mercy, but if it is nearer to the wicked people, he will be given to the angels of punishment."
They measured the ground. Because the man had just set out, he was still closer to the wicked. But because he was sincere in his repentance, the Lord moved the spot where he lay and brought it to just outside the city of the good people.
That penitent servant was handed over to the angels of merry.
Repentance is the most noble and beloved form of obedience in the eyes of Allah. He loves those who repent. Repentance has a status that no other form of worship has. This is why Allah is extremely happy when a servant repents just as a desert traveler may be happy when he finds his lost camel.
"Except those who repent, have faith and do good deeds, for such people Allah will change their sins for good deeds. Certainly Allah is most forgiving and merciful." (Qur'an 25:70)