It was narrated that ash-Sha'bi said: A freed slave woman of Sa’eed bin Qais, who was married and had committed an immoral action, was brought to 'Ali, he gave her one hundred lashes then he stoned her. Then he said: I flogged her in accordance with the Book of Allah and I stoned her in accordance with the Sunnah of the Messenger of Allah ﷺ.
The punishment given by 'Ali was not done out of anger or vengeance but rather out of justice and fairness in accordance with Islamic teachings. It also serves as an example for us today on how we should deal with such cases when they arise in our society - we must be fair and just while punishing those who have done wrong without any bias or prejudice towards them.