You might say: what does it mean for Him, the most high, to be merciful and to be the most merciful of those who are merciful?
For one who is merciful does not see people afflicted or injured, tormented or sick, without hastening to remove that condition when he can do so. But the Lord-praise be to Him most high- has the power to meet every affliction, to stave off every need and distress, to eliminate every sickness and to remove every harm, even though He leaves His servants to be tried by disasters and hardships while the world is overflowing with disease, calamities and tribulations, yet He is able to remove them all.
The merciful one certainly wants good for the one who receives mercy. Yet there is no evil in existence which does not contain some good within it, and were evil to be eliminated, the good within it would be nullified, and the final result would be an evil worse than the evil containing the good.
The certain amputation of hand* is an evident evil yet within it lies and ample good: the health of a body. If one were to forego the amputation of the hand, the body would perish as a result - a worse evil still. So amputating a hand for the health of a body is an evil which contains good within it. But the primary intention which comes first in the consideration of one amputating is health - an unadulterated good. Yet since amputating the hand is the way to achieve it, amputation is intended for the sake of that good; so health was sought for itself first, and amputation second for the sake of the other and not for itself.
They both enter into the intention, but one of them is intended for itself and the other for sake of the first, and what is intended for its own sake takes precedence over that which is intended for the sake of the other: here the saying of God- great and glorious - is a propos: 'My mercy precedes My anger" (Hadith Qudsi, Bukhari).
His anger is His intending evil so evil is by His intention, while His mercy is His intending good (so good is by His intention). But if He intended good for the good itself, yet intended evil not for itself but because there is some good within it; then good is accomplished essentially but evil is accomplished accidentally and each according to divine decree. So nothing here goes against mercy at all."
*if it was afflicted with gangrene, for example
Course: Allah's Most Beautiful Names Explained