2 Samuel 19:17

And there were a thousand men of Benjamin with him, and Ziba the servant of the house of Saul, and his fifteen sons and his twenty servants with him; and they went over Jordan before the king.

This verse belongs to David's return to Jerusalem after Absalom's death. At that time God had turned the hearts of Israel to David as the heart of one man. Shimei had cursed David during David's humiliation.

Shimei came among the first of the rebels to meet David and confessed his rebellious conduct. He came moved by fear for his life. Those who had witnessed his abuse urged David not to spare him but to put him to death. Their argument was that he had cursed the Lord's anointed.

David rebuked those urging punishment. David spared Shimei's life and mercifully forgave him. In doing so David refused revenge, though he could readily have put the offender to death.