'Abdullah bin Mas'ud (May Allah bepleased with him) reported:
Messenger of Allah (ﷺ) said, "The first defect (in religion) which affected the Children of Israel in the way that man would meet another and say to him: 'Fear Allah and abstain from what you are doing, for this is not lawful for you.' Then he would meet him the next day and find no change in him, but this would not prevent him from eating with him, drinking with him and sitting in his assemblies. When it came to this, Allah led their hearts into evil ways on account of their association with others." Then he (ﷺ) recited, "Those among the Children of Israel who disbelieved were cursed by the tongue of Dawud (David) and 'Isa (Jesus), son of Maryam (Mary). That was because they disobeyed (Allah and the Messengers) and were ever transgressing beyond bounds. They used not to forbid one another from the Munkar (wrong, evildoing, sins, polytheism, disbelief) which they committed. Vile indeed was what they used to do. You see many of them taking the disbelievers as their Auliya' (protectors and helpers). Evil indeed is that which their own selves have sent forward before them; for that (reason) Allah's wrath fell upon them and in torment will they abide. And had they believed in Allah and in the Prophet (Muhammad (ﷺ)) and in what has been revealed to him, never would they have taken them (the disbelievers) as Auliya' (protectors and helpers); but many of them are the Fasiqun (rebellious, disobedient to Allah)." (5:78-81)Then he (ﷺ) continued: "Nay, by Allah, you either enjoin good and forbid evil and catch hold of the hand of the oppressor and persuade him to act justly and stick to the truth, or, Allah will involve the hearts of some of you with the hearts of others and will curse you as He had cursed them".[Abu Dawud and At-Tirmidhi].The wording in At-Tirmidhi is: Messenger of Allah (ﷺ) said, "When the Children of Israel became sinful, their learned men prohibited them but they would not turn back. Yet, the learned men associated with them and ate and drank with them. So, they were cursed at the tongues of Dawud and 'Isa (Jesus), son of Maryam (Mary), because they were disobedient and were given to transgression." At this stage Messenger of Allah (ﷺ) who was reclining on a pillow sat up and said, "No, By Him in Whose Hand my soul is, there is no escape for you but you persuade them to act justly."
Arabic/English book reference: Book 1, Hadith 196