Allah T'ala says in the Holy Quran:
(4:148) Allah does not like speaking evil publicly unless one has been wronged. Allah is All-Hearing, All-Knowing.
(4:149) (Even though you have the right to speak evil if you are wronged), if you keep doing good -whether openly or secretly -or at least pardon the evil (then that is the attribute of Allah). Allah is All-Pardoning and He has all the power to chastise.
This verse embodies a moral directive of very high value to the Muslims. The hypocrites, the Jews and the polytheists were all bent on placing all kinds of obstacles in the way of the spread of Islam: They eagerly persecuted the Muslims and used all possible means, however malicious, against them. Such an attitude inevitably created anger and resentment. It was in the context of this storm of bitter feelings that God told the Muslims that He did not consider speaking ill of people as praiseworthy. No doubt the Muslims had been wronged, and if a wronged person speaks out against a wrong-doer, he is quite justified in doing so. Even though this is a person's right, it is more meritorious to continue to do good both in public and in private, and to ignore the misdeeds of others. For one's ideal should be to try to approximate to God's way as far as possible. God with whom one wants to be close is lenient and forbearing; He provides sustenance even to the worst criminals and seeks mitigating circumstances in even the most serious offences. In order to become close to God, one ought to be generous in spirit and full of tolerance. (Tafheemul Quran)