Likewise, all obligatory and recommended deeds that compete with one another are beloved to Allah. When they compete, precedence is given to whichever is most beloved to Him. Drawing near to Him through obligatory deeds is more beloved to Him than drawing near to Him through voluntary deeds, and some obligatory and recommended deeds are more beloved to Him than others.
Likewise, when what is commanded conflicts with what is forbidden, something He loves conflicts with something He hates. Precedence is then determined by which is greater: if His love for what is commanded exceeds His hatred for what is forbidden, fulfilling the command takes precedence; if His hatred for what is forbidden exceeds His love for what is commanded, avoiding the prohibition takes precedence.
As the Most High says:
“They ask you about wine and gambling. Say, ‘In them is great sin and benefit for people. But their sin is greater than their benefit.’”
[Surah al-Baqarah 219]
The Sharia is established upon this principle: giving precedence to the greater of two goods, averting the greater of two evils, and giving precedence to whichever predominates when good and evil are combined.
Allah, glorified be He, loves attributes of perfection, such as knowledge, power, mercy, and the like. Thus, in Sahīh Muslim, Abū Hurayrah reports that the Prophet (peace and blessings be upon him) said:
“The strong believer is better and more beloved to Allah than the weak believer, though there is good in both.”
It is also authentically reported that he said:
“Allah does not show mercy to those who do not show mercy to people.”