Islam allows justice and a proportionate response to wrong, and it strongly recommends forgiveness. The Quran says that the reward for a bad deed is a bad deed like it, but whoever forgives and makes peace, their reward is with God.
The fuller answer
The Quran tells believers to repel evil with what is better, so that the one between you and whom is hatred will become like a close friend. Its description of the righteous includes 'those who restrain their anger and pardon people'. The Prophet ﷺ forgave the people of Mecca after years of persecution, and his answer to a man who asked for advice was: 'Do not become angry'.
In law, the family of a murder victim may choose retaliation, accept compensation or forgive, and forgiveness is described as better. Muslims believe that, in the end, forgiving others is the way to receive God's forgiveness.
And not equal are the good deed and the bad. Repel [evil] by that [deed] which is better; and thereupon the one whom between you and him is enmity [will become] as though he was a devoted friend.
And the retribution for an evil act is an evil one like it, but whoever pardons and makes reconciliation - his reward is [due] from Allah. Indeed, He does not like wrongdoers.
O you who have believed, prescribed for you is legal retribution for those murdered - the free for the free, the slave for the slave, and the female for the female. But whoever overlooks from his brother anything, then there should be a suitable follow-up and payment to him with good conduct. This is an alleviation from your Lord and a mercy. But whoever transgresses after that will have a painful punishment.
This answer follows the mainstream Sunni understanding and is general learning, not a fatwa. Where Muslims differ, the answer says so. Have a question of your own? Write to us.