When the Prophet faced character assassination, he would not get provoked. He would hear with a calm mind and pray. But if a person broke a principle, the Prophet would become stern and even get angry. All incidents about the Prophet's anger are related to breaking of principle.
The Prophet used to become angry on matters of principle. He never became angry when someone spoke harshly with him. Once a person said to the Prophet: مُذَمَّمًا أَبَيْنَا. "We condemn you. You are a bad person." (al-Mustadrak al-Hakim 3376)
The Prophet did not become angry at this. He heard the person in a normal way and prayed for him. When someone attacked the Prophet's personality, he never became angry. But if it were a matter of principle, the Prophet would become angry. We receive guidance from this. Anger is not bad in the absolute sense. Anger does not mean to start hitting someone. Anger means to become very stern and take something very sensitively. Anger is not hitting people, or abusing them.
When the Prophet faced character assassination, he would not get provoked. He would hear with a calm mind and pray. But if a person broke a principle, the Prophet would become stern and even get angry.
All incidents about the Prophet's anger are related to breaking of principle. As far as the Prophet's personality was concerned, people would say: يَا أَيُّهَا الَّذِي نُزِّلَ عَلَيْهِ الذِّكْرُ إِنَّكَ لَمَجْنُونٌ "O Prophet! You are most surely insane." (15:6) Someone even said to the Prophet: "You are a liar!" (Musannaf Ibn Abi Shaybah 822) But the Prophet did not become angry. Those who become provoked when someone says anything against the Prophet are behaving in a way that is not encouraged in Islam.