2 Samuel 4:9 And David made answer to Rechab and his brother Baanah, the sons of Rimmon the Beerothite, and said to them, By the living Lord, who has kept me safe from all my trouble,
10 When one came to me with the news of Saul’s death, in the belief that it would be good news, I took him and put him to death in Ziklag, which was the reward I gave him for his news:
11 How much more, when evil men have put an upright person to death, in his house, sleeping on his bed, will I take payment from you for his blood, and have you cut off from the earth?
12 And David gave orders to his young men and they put them to death, cutting off their hands and their feet and hanging them up by the side of the pool in Hebron. But they took the head of Ish-bosheth and put it in its last resting-place with Abner’s body in Hebron. (BBE)
David refused to give honor to the men who had killed Ishbosheth in order to make him king. In fact he ordered their execution.
Let me suggest the following secenarios. David refused to be a part of their treachery and by executing them was declaring his horror at their actions.
David is recognizing some actions are right and some are not. He followed the rules of engagement whether his enemies did nor did not.
David was also practicing justice. He was not prepared to accept the Kingdom at any price. Justice would not be abrogated just to advance his cause. How easy it is for people to live by principle unless the abandonment of that principle produces profit, promotion, prestige or popularity for them.
David also recognized the treachery of these men should not be rewarded. If that had assassinated one king they would be willing to assassinate another. He knew he could never really be at peace as long as they lived. Those who promote you by treachery will also raise their hand against you if it is to their advantage to do so.