2 Samuel 16:5-14 ESV
When King David came to Bahurim, there came out a man of the family of the house of Saul, whose name was Shimei, the son of Gera, and as he came he cursed continually. And he threw stones at David and at all the servants of King David, and all the people and all the mighty men were on his right hand and on his left. And Shimei said as he cursed, “Get out, get out, you man of blood, you worthless man! The LORD has avenged on you all the blood of the house of Saul, in whose place you have reigned, and the LORD has given the kingdom into the hand of your son Absalom. See, your evil is on you, for you are a man of blood.”
Then Abishai the son of Zeruiah said to the king, “Why should this dead dog curse my lord the king? Let me go over and take off his head.” But the king said, “What have I to do with you, you sons of Zeruiah? If he is cursing because the LORD has said to him, ‘Curse David,’ who then shall say, ‘Why have you done so?’” And David said to Abishai and to all his servants, “Behold, my own son seeks my life; how much more now may this Benjaminite! Leave him alone, and let him curse, for the LORD has told him to. It may be that the LORD will look on the wrong done to me, and that the LORD will repay me with good for his cursing today.” So David and his men went on the road, while Shimei went along on the hillside opposite him and cursed as he went and threw stones at him and flung dust. And the king, and all the people who were with him, arrived weary at the Jordan. And there he refreshed himself.
ESV: English Standard Version 2016