Imam Ridha’ (a.s) has narrated that once a man holding a bloodstained knife was brought to Umar. Those who had arrested him reported that a severed head was found in such and such desolate spot, and that they found this man standing near it. Umar asked the accused if he had committed the murder of the victim. He confessed to it. Umar ordered his execution. In a short while another person appeared and said, “Release him, because I am the actual murderer.” Umar was confused and could not decide what to do, so he sent the matter to Amir’ul-Mu’minin (a.s). Ali (a.s) asked the first accused, “Did you kill that man?”
He replied, “O Amir’ul-Mu’minin! The fact is that I am a butcher and I was slaughtering a goat at a place when I had the urge urinate. Holding the blood-smeared knife I went to answer nature’s call in that ruin where I saw that murdered man. I was staring at the corpse when these people came and arrested me. When I was brought to the caliph I confessed to the murder because all the circumstantial evidence was against me and my denial would not have made any impact. But the truth is that I have not murdered anyone.” Now Ali (a.s) turned to the second man and asked if he was the murderer.
He said, “Yes, I wanted to run away where no one would learn about it but when I saw that an innocent man was falsely accused, my conscience could not bear it that I should be saved and an innocent is executed instead. So I came here myself and confessed to the murder. Ali (a.s) asked Imam Hasan (a.s) what judgment he would give in this case. He replied at once, “Both the men should be released and the blood money of the victim should be paid from the public treasury.” When Ali (a.s) asked him to justify his decision he said, “One of them is innocent and the other one deserves release because he has saved the life of an innocent person. Almighty Allah says: One who saved the life of one person, it is as if he has saved humanity.”
Reference :Akhlaq al-A’imma, Morals & Manners of the Holy Imams