When David was about to die, he instructed his son Solomon,
"I'm about to leave this world. Be strong and mature.
Fulfill your duty to the LORD your God. Obey his directions, laws, commands, rules, and written instructions as they are recorded in Moses' Teachings. Then you'll succeed in everything you do wherever you may go.
[You'll succeed] because the LORD will keep the promise he made to me: 'If your descendants are faithful to me with all their hearts and lives, you will never fail to have an heir on the throne of Israel.'
"You know what Joab (Zeruiah's son) did to me and to the two commanders of Israel's army--Abner, son of Ner, and Amasa, son of Jether. Joab killed them. When there was peace, he shed blood as if it were wartime. With their blood he stained the belt around his waist and the shoes on his feet.
Use your wisdom. Don't let that gray-haired, old man go to his grave peacefully.
"Be kind to the sons of Barzillai from Gilead. Let them eat at your table. They helped me when I was fleeing from your brother Absalom.
"Shimei, son of Gera from Bahurim in Benjamin, is still with you. He cursed me repeatedly when I went to Mahanaim. But when he came to meet me at the Jordan River, I took an oath by the LORD and said, 'As long as I'm king, I won't have you killed.'
Now, don't let him go unpunished. You are wise and know what to do to him: Put that gray-haired, old man into his grave by slaughtering him."
David lay down in death with his ancestors and was buried in the City of David.
He ruled as king of Israel for 40 years. He ruled for 7 years in Hebron and for 33 years in Jerusalem.
Solomon sat on his father David's throne, and his power was firmly established.
Then Adonijah, son of Haggith, went to Bathsheba, Solomon's mother. "Is this a friendly visit?" she asked. "Yes," he answered.
Then he added, "I have a matter [to discuss] with you." "What is it?" she asked.
He said, "You know the kingship was mine. All Israel expected me to be their king. But the kingship has been turned over to my brother because the LORD gave it to him.
Now I want to ask you for one thing. Don't refuse me." "What is it?" she asked.
He said, "Please ask King Solomon to give me Abishag from Shunem as my wife. He will not refuse you."
"Very well," Bathsheba answered. "I will talk to the king for you."
Bathsheba went to King Solomon to talk to him on Adonijah's behalf. The king got up to meet her and bowed down in front of her. Then he sat on his throne. He had a throne brought for his mother, and she sat at his right side.
"I'm asking you for one little thing," she said. "Don't refuse me." "Ask, Mother," the king told her. "I won't refuse you."
She replied, "Let Abishag from Shunem be given to your brother Adonijah as his wife."
King Solomon then said, "Why do you ask that Abishag from Shunem be given to Adonijah? That would be the same as giving him the kingship. After all, he is my older brother. The priest Abiathar and Joab (Zeruiah's son) are supporting him."
King Solomon took an oath by the LORD and said, "May God strike me dead if Adonijah doesn't pay with his life for this request!
The LORD set me on my father David's throne and gave me a dynasty as he promised. So I solemnly swear, as the LORD who has established me lives, that Adonijah will be put to death today."
King Solomon gave this task to Benaiah, son of Jehoiada. Benaiah attacked and killed Adonijah.
The king told the priest Abiathar, "Go to your land in Anathoth. You deserve to die, but I won't kill you at this time because you carried the ark of the Almighty LORD ahead of my father David and because you shared all my father's sufferings."
So Solomon removed Abiathar as the LORD's priest and fulfilled the LORD's word spoken at Shiloh about Eli's family.
The news reached Joab. (He had supported Adonijah, although he hadn't supported Absalom.) So Joab fled to the LORD's tent and clung to the horns of the altar.
After King Solomon heard that Joab had fled to the altar in the tent of the LORD, Solomon sent Benaiah, son of Jehoiada, to kill Joab.
When Benaiah came to the tent of the LORD, he told Joab, "The king says, 'Come out.'" "No," Joab answered, "I'll die here." So Benaiah reported to the king what Joab had said and how he had answered.
The king answered, "Do as he said. Kill him, and bury him. You can remove the innocent blood--the blood which Joab shed--from me and my father's family.
The LORD will repay him for the slaughter he caused. Joab killed two honorable men who were better than he was. He used his sword to kill Abner (who was the son of Ner and the commander of Israel's army) and Amasa (who was the son of Jether and the commander of Judah's army). Joab did this without my father's knowledge.
The responsibility for their blood will fall on Joab and his descendants forever. But may David, his descendants, family, and throne always receive peace from the LORD."
Then Benaiah, son of Jehoiada, went and attacked Joab, killed him, and buried him at his home in the desert.
The king then appointed Benaiah, son of Jehoiada, to replace Joab as commander of the army. King Solomon also replaced Abiathar with the priest Zadok.
The king summoned Shimei and said to him, "Build a house for yourself in Jerusalem, and stay there. Don't leave [the city] to go anywhere else.
But the day you leave and cross the brook in the Kidron Valley, you can be certain that you will die. You will be responsible for your own death."
"Very well," Shimei answered. "I'll do just what Your Majesty said." So Shimei stayed in Jerusalem for a long time.
But after three years, two of Shimei's slaves fled to Gath's King Achish, son of Maacah. Shimei was told that his slaves were in Gath,
so he saddled his donkey and went to Achish in Gath to search for his slaves. Shimei went to Gath and got his slaves.
After Solomon heard that Shimei had gone from Jerusalem to Gath and back,
he summoned Shimei. Solomon asked him, "Didn't I make you take an oath by the LORD? Didn't I warn you that if you left [the city] to go anywhere, you could be certain that you would die? Didn't you say to me, 'Very well. I'll do just what you said'?
Why didn't you keep your oath to the LORD and obey the command I gave you?
Shimei, you know in your heart all the evil that you did to my father David. The LORD is going to pay you back for the evil you have done.
But King Solomon is blessed, and David's dynasty will always be firmly established by the LORD."
Then the king gave orders to Benaiah, son of Jehoiada. He went to attack and kill Shimei. Solomon's power as king was now firmly established.