It was narrated from Abu Hurairah that the Messenger of Allah ﷺ said: "Ward off the legal punishments as much as you can".
The Prophet Muhammad was known for his mercy and compassion towards others, so this hadith serves as an example of how he wanted his followers to act in similar situations. He wanted them to show mercy towards those who may have broken the law or committed a crime, while still upholding justice at all times. By avoiding legal punishments whenever possible, Muslims are able show their respect for the law while still being merciful towards others who may have made mistakes or done wrongs against them or society at large.