As the time approached for David to die, he instructed his son Solomon,
"As for me, I am going the way of all of the earth. Be strong and brave,
and keep your obligation to the LORD your God to walk in His ways and to keep His statutes, commandments, judgments, and testimonies. This is written in the law of Moses, so that you will have success in everything you do and wherever you turn,
and so that the LORD will carry out His promise that He made to me: 'If your sons are careful to walk faithfully before Me with their whole mind and heart, you will never fail to have a man on the throne of Israel.'
"You also know what Joab son of Zeruiah did to me and what he did to the two commanders of Israel's army, Abner son of Ner and Amasa son of Jether. He murdered them [in a time] of peace to avenge blood shed in war. He spilled that blood on his own waistband and on the sandals of his feet.
Act according to your wisdom, and do not let his gray head descend to Sheol in peace.
"Show loyalty to the sons of Barzillai the Gileadite and let them be among those who eat at your table because they supported me when I fled from your brother Absalom.
"Keep an eye on Shimei son of Gera, the Benjaminite from Bahurim who is with you. He uttered malicious curses against me the day I went to Mahanaim. But he came down to meet me at the Jordan River, and I swore to him by the LORD: 'I will never kill you with the sword.'
So don't let him go unpunished, for you are a wise man. You know how to deal with him to bring his gray head down to Sheol with blood."
Then David rested with his fathers and was buried in the city of David.
The [length of] time David reigned over Israel was 40 years: he reigned seven years in Hebron and 33 years in Jerusalem.
Solomon sat on the throne of his father David, and his kingship was firmly established.
Now Adonijah son of Haggith came to Bathsheba, Solomon's mother. She asked, "Do you come peacefully?" "Peacefully," he replied,
and then asked, "May I talk with you?" "Go ahead," she answered.
"You know the kingship was mine," he said. "All Israel expected me to be king, but then the kingship was turned over to my brother, for the LORD gave it to him.
So now I have just one request of you; don't turn me down." She said to him, "Go on."
He replied, "Please speak to King Solomon since he won't turn you down. Let him give me Abishag the Shunammite as a wife."
"Very well," Bathsheba replied. "I will speak to the king for you."
So Bathsheba went to King Solomon to speak to him about Adonijah. The king stood up to greet her, bowed to her, sat down on his throne, and had a throne placed for the king's mother. So she sat down at his right hand.
Then she said, "I have just one small request of you. Don't turn me down." "[Go ahead and] ask, mother," the king replied, "for I won't turn you down."
So she said, "Let Abishag the Shunammite be given to your brother Adonijah as a wife."
King Solomon answered his mother, "Why are you requesting Abishag the Shunammite for Adonijah? Since he is my elder brother, you might as well ask the kingship for him, for Abiathar the priest, and for Joab son of Zeruiah."
Then Solomon took an oath by the LORD: "May God punish me and do so severely if Adonijah has not made this request at the cost of his life.
And now, as the LORD lives, the One who established me, seated me on the throne of my father David, and made me a dynasty as He promised-- I swear Adonijah will be put to death today!"
Then King Solomon gave the order to Benaiah son of Jehoiada, who struck down Adonijah, and he died.
The king said to Abiathar the priest, "Go to your fields in Anathoth. Even though you deserve to die, I will not put you to death today, since you carried the ark of the Lord God in the presence of my father David and you suffered through all that my father suffered."
So Solomon banished Abiathar from being the LORD's priest, and it fulfilled the LORD's prophecy He had spoken at Shiloh against Eli's family.
The news reached Joab. Since he had supported Adonijah but not Absalom, Joab fled to the LORD's tabernacle and took hold of the horns of the altar.
It was reported to King Solomon: "Joab has fled to the LORD's tabernacle and is now beside the altar." Then Solomon sent Benaiah son of Jehoiada and told [him], "Go and strike him down!"
So Benaiah went to the tabernacle and said to Joab, "This is what the king says: 'Come out!' " But Joab said, "No, for I will die here." So Benaiah took a message back to the king, "This is what Joab said, and this is how he answered me."
The king said to him, "Do just as he says. Strike him down and bury him in order to remove from me and from my father's house the blood that Joab shed without just cause.
The LORD will bring back his own blood on his own head because he struck down two men more righteous and better than he, without my father David's knowledge. With his sword, Joab murdered Abner son of Ner, commander of Israel's army, and Amasa son of Jether, commander of Judah's army.
Their blood will come back on Joab's head and on the head of his descendants forever, but for David, his descendants, his dynasty, and his throne, there will be peace from the LORD forever."
Benaiah son of Jehoiada went up, struck down Joab, and put him to death. He was buried at his house in the wilderness.
Then the king appointed Benaiah son of Jehoiada in Joab's place over the army, and he appointed Zadok the priest in Abiathar's place.
Then the king summoned Shimei and said to him, "Build a house for yourself in Jerusalem and live there, but don't leave there [and go] anywhere else.
On the day you do leave and cross the Kidron Valley, know for sure that you will certainly die. Your blood will be on your own head."
Shimei said to the king, "The sentence is fair; your servant will do as my lord the king has spoken." And Shimei lived in Jerusalem for a long time.
But then, at the end of three years, two of Shimei's slaves ran away to Achish son of Maacah, king of Gath. Shimei was informed, "Look, your slaves are in Gath."
So Shimei saddled his donkey and set out to Achish at Gath to search for his slaves. He went and brought them back from Gath.
It was reported to Solomon that Shimei had gone from Jerusalem to Gath and had returned.
So the king summoned Shimei and said to him, "Didn't I make you swear by the LORD and warn you, saying, 'On the day you leave and go anywhere else, know for sure that you will certainly die'? And you said to me, 'The sentence is fair; I will obey.'
So why have you not kept the LORD's oath and the command that I gave you?"
The king also said, "You yourself know all the evil that you did to my father David. Therefore, the LORD has brought back your evil on your head,
but King Solomon will be blessed, and David's throne will remain established before the LORD forever."
Then the king commanded Benaiah son of Jehoiada, and he went out and struck Shimei down, and he died. So the kingdom was established in Solomon's hand.