The believer should analyze the situation in the light of faith and sharee’ah, and ignore his whims and desires. If his shunning and keeping away from the innovator will not result in a greater evil, then it is prescribed, and at the very least it is Sunnah. Similarly, shunning those who openly commit sin is at the very least Sunnah. But if not shunning them will be more effective because one thinks that calling these innovators, guiding them to the Sunnah and teaching them what Allaah has enjoined upon them will be more effective in guiding them, then he should not hasten to shun them, but he should hate them for the sake of Allaah just as he hates the kaafirs and sinners. But his hatred for the kuffaar should be greater, whilst also calling them to Allaah and striving to guide them, acting in accordance with all the shar’i evidence. So he should hate the innovator in accordance with the degree of his innovation, so long as it does not imply kufr, and he should hate the sinner in accordance with the degree of his sin, but he should also love him for the sake of Allaah in accordance with the degree of his Islam and faith. From this we know that shunning depends on the situation.
Conclusion: the most correct approach is to look at the shar’i interests involved, because the Prophet (peace and blessings of Allaah be upon him) shunned some people and not others, depending on the objectives of Islam. He shunned Ka’b ibn Maalik and his two companions (may Allaah be pleased with them) when they stayed behind from the campaign of Tabook with no excuse. He shunned them for fifty days, until they repented and Allaah accepted their repentance. But he did not shun ‘Abd-Allaah ibn Ubayy ibn Salool and a group of those who were accused of hypocrisy, for shar’i reasons.
The believer looks at what is in the best interests (of Islam). This does not contradict the idea of hating the kaafirs, innovators and sinners for the sake of Allaah and loving the Muslims for the sake of Allaah. Attention must be paid to what is in the general interest; if shunning is better then they should be shunned, but if the objectives of Islam dictate that ongoing da’wah efforts should be made rather than shunning, then that is what should be done, following the teaching of the Prophet (peace and blessings of Allaah be upon him). And Allaah is the Source of strength.