بسم الله الرحمن الرحيم
The Prophet (pbuh) exemplified this behavior. He never returned people’s personal unkindness to him, because he was focused on the greater goal. When he went to T’aif, and was kicked out, the Angel came to him he could destroy them if he asked. But the Prophet (pbuh) refused, hoping that the next generation would be better. Despite the personal abuse he endured in Makkah, we do not hear of the Prophet (pbuh) responding with the same. The people who were against him in Makkah had to resort to obscure insults, such as a sorcerer or a poet, because they could not say anything bad about his character. When he was able to liberate Makkah after 9 years of being in exile, he did not slaughter his enemies. He gave them safety. One of the companions said “Today is the day of malhama!” meaning a great battle or slaughter, but the Prophet (pbuh) responded with “No. Today is the day of marhama” meaning a day of mercy.
There are times when you have to defend your community, as was the case with the wars when the Prophet (pbuh) was in Madina. Pushing away the bad with good doesn’t mean being weak. It means you are stronger. Even when you defend your right, you do it in an ethical way. Abu Jahal had borrowed money from a man and refused to give it back. So that man went to the Prophet (pbuh) to help him, not really knowing the situation in Makkah. And the Prophet (pbuh) went with him and helped him get his money back from Abu Jahal. He helped a man with his rights. But the way in which he did it was better.
If ever you are faced with a personal attack, know that Allah is aware. Respond with what is better.