Hatred of a people must not lead to transgression or injustice

In Makkah there were non-believers who inflicted great hardships on the believers for a long time, even, obstructing their entry to the Sacred Masjid. When the believers overcame them, there was a feeling of revenge and hostile hatred towards the non-believers. Allah commanded to the believers that such a feeling should not induce them to indulge in transgression and that it must not make them deviate from the path of Justice and Equity

…Let not the (hostile) hatred of a people - because they hindered you from the Sacred Masjid - incite you to exceed the Just or Proper limits or to transgress the Law…[5:2]

…Let not the (hostile) hatred of a people make you deviate from the path of Justice. Always, and in all circumstances, act justly…[5:8]