He was a human being

Anas bin Malik reported that there was an orphan girl with Umm Sulaim (who was the mother of Anas). Allah's Messenger (sallallaahu alayhi wa sallam) saw that orphan girl and said:


O, it is you; you have grown young. May you not advance in years! That slave-girl returned to Umm Sulaim weeping.



Umm Sulaim said: O daughter, what is the matter with you? She said: Allah's Messenger (sallallaahu alayhi wa sallam) has invoked curse upon me that I should not grow in age and thus I would never grow in age, or she said, in my (length) of life.



Umm Sulaim went out wrapping her head-dress hurriedly until she met Allah's Messenger (sallallaahu alayhi wa sallam). He said to her: Umm Sulaim, what is the matter with you? She said: Allah's Apostle, you invoked curse upon my orphan girl.


He said: Umm Sulaim, what is that? She said: She (the orphan girl) states you have cursed her saying that she might not grow in age or grow in life.



Allah's Messenger (sallallaahu alayhi wa sallam) smiled and then said: Umm Sulaim, don't you know that I have made this term with my Lord. And the term with my Lord is that I said to Him: I am a human being and I am pleased just as a human being is pleased and I lose temper just as a human being loses temper, so for any person from amongst my Ummah whom I curse and he in no way deserves it, let that, O Lord, be made a source of purification and purity and nearness to (Allah) on the Day of Resurrection.

Sahiih Muslim Hadiith No. 2603






ثم قال عن الرواية الثامنة وفيها قيد "بدعوة ليس لها بأهل

Then, Imaam al-Nawawi says about the narration above which includes the stipulation "whom I curse and he in no way deserves it"



قال وهذه الرواية تبين المراد بباقي الروايات المطلقة

This narration makes clear the intent of the other general narrations


وأنه إنما يكون دعاؤه عليه رحمة وكفارة وزكاة ونحو ذلك إذا لم يكن أهلا للدعاء عليه ولم يكن أهلا لسبه ولعنه بأن كان مسلما غير مرتكب لكبيرة ظاهرة


And that intent is that his (sallallaahu alayhi wa sallam) du'aa against someone was a mercy, expiation, and zakaah for that person when he was not deserving of his curse by way of the fact that the person was a Muslim who had not indulged in any apparent major sin


وإلا فقد دعا صلى الله عليه وسلم على الكفار والمنافقين ولم يكن ذلك لهم رحمة

Otherwise, he sallallaahu alayhi wa sallam did make du'aa against the kuffaar and munaafiquun and that was not a mercy for them.



Reference(s):
فتح المنعم شرح صحيح مسلم
Volume 10 Page 85