Dr. Marawan Shahin, Professor of Hadith and its Sciences, Faculty of Usul Ad-Din (Theology),Al-Azhar Univ. states: “It should be clear that forsaking those sinful Muslims should be based on the desired result from that abandonment. So, it differs from one person to another and from one case to another.
Coming closer to someone may be beneficial for correcting his misbehaviour and pushing him to come back to the right path. Also, forsaking another one may be a means of rebuking him and a trial to let him come back to the right track. However, it should be clear that forsaking people is not the basic ruling as we are forbidden to forsake fellow Muslims unless there is a considerable interest (maslahah) behind that act. Moreover, despite his sinful deeds, he has the rights of Muslims; when a Muslim meets him he has to greet him by saying As-Salamu `Alaykum. If he needs your help to stay away from sins, you have to back him.
With the above in mind, it becomes clear that the issue needs intelligence in dealing. So, one can use the means he sees good for helping a sinful person to come back to the right path. May Allah reward you and grant you success in this worldly life and in the Hereafter.”