Joab had not joined Absalom’s earlier rebellion, but he had joined Adonijah’s rebellion. So when Joab heard about Adonijah’s death, he ran to the sacred tent of the LORD and grabbed on to the horns of the altar.
When this was reported to King Solomon, he sent Benaiah son of Jehoiada to execute him.
Benaiah went to the sacred tent of the LORD and said to Joab, “The king orders you to come out!” But Joab answered, “No, I will die here.” So Benaiah returned to the king and told him what Joab had said.
“Do as he said,” the king replied. “Kill him there beside the altar and bury him. This will remove the guilt of Joab’s senseless murders from me and from my father’s family.
The LORD will repay him for the murders of two men who were more righteous and better than he. For my father knew nothing about the deaths of Abner son of Ner, commander of the army of Israel, and of Amasa son of Jether, commander of the army of Judah.
May their blood be on Joab and his descendants forever, and may the LORD grant peace forever to David, his descendants, his dynasty, and his throne.”
So Benaiah son of Jehoiada returned to the sacred tent and killed Joab, and he was buried at his home in the wilderness.
Then the king appointed Benaiah to command the army in place of Joab, and he installed Zadok the priest to take the place of Abiathar.
The king then sent for Shimei and told him, “Build a house here in Jerusalem and live there. But don’t step outside the city to go anywhere else.
On the day you so much as cross the Kidron Valley, you will surely die; and your blood will be on your own head.”
Shimei replied, “Your sentence is fair; I will do whatever my lord the king commands.” So Shimei lived in Jerusalem for a long time.