Since it was almost time for David to die, he gave his son Solomon his last commands.
David said, "My time to die is near. Be a good and strong leader.
Obey the Lord your God. Follow him by obeying his demands, his commands, his laws, and his rules that are written in the teachings of Moses. If you do these things, you will be successful in all you do and wherever you go.
And if you obey the Lord, he will keep the promise he made to me. He said: 'If your descendants live as I tell them and have complete faith in me, a man from your family will always be king over the people of Israel.'
"Also, you remember what Joab son of Zeruiah did to me. He killed the two commanders of Israel's armies: Abner son of Ner and Amasa son of Jether. He did this as if he and they were at war, although it was a time of peace. He put their blood on the belt around his waist and on his sandals on his feet.
Punish him in the way you think is wisest, but do not let him die peacefully of old age.
"Be kind to the children of Barzillai of Gilead, and allow them to eat at your table. They welcomed me when I ran away from your brother Absalom.
"And remember, Shimei son of Gera, the Benjaminite, is here with you. He cursed me the day I went to Mahanaim. But when he came down to meet me at the Jordan River, I promised him before the Lord, 'Shimei, I will not kill you.'
But you should not leave him unpunished. You are a wise man, and you will know what to do to him, but you must be sure he is killed."
Then David died and was buried with his ancestors in Jerusalem.
He had ruled over Israel forty years -- seven years in Hebron and thirty-three years in Jerusalem.
Solomon became king after David, his father, and he was in firm control of his kingdom.
At this time Adonijah son of Haggith went to Bathsheba, Solomon's mother. "Do you come in peace?" Bathsheba asked. "Yes. This is a peaceful visit," Adonijah answered.
"I have something to say to you." "You may speak," she said.
"You remember that at one time the kingdom was mine," Adonijah said. "All the people of Israel recognized me as their king, but things have changed. Now my brother is the king, because the Lord chose him.
Now I have one thing to ask you; please do not refuse me." Bathsheba answered, "What do you want?"
"I know King Solomon will do anything you ask him," Adonijah continued. "Please ask him to give me Abishag the Shunammite to be my wife."
"Very well," she answered. "I will speak to the king for you."
So Bathsheba went to King Solomon to speak to him for Adonijah. When Solomon saw her, he stood up to meet her, then bowed down, and sat on the throne. He told some servants to bring another throne for his mother. Then she sat down at his right side.
Bathsheba said, "I have one small thing to ask you. Please do not refuse me." "Ask, mother," the king answered. "I will not refuse you."
So she said, "Allow Abishag the Shunammite to marry your brother Adonijah."
King Solomon answered his mother, "Why do you ask me to give him Abishag? Why don't you also ask for him to become the king since he is my older brother? Abiathar the priest and Joab son of Zeruiah would support him!"
Then King Solomon swore by the name of the Lord, saying, "May God punish me terribly if this doesn't cost Adonijah his life!
By the Lord who has given me the throne that belonged to my father David and who has kept his promise and given the kingdom to me and my people, Adonijah will die today!"
Then King Solomon gave orders to Benaiah son of Jehoiada, and he went and killed Adonijah.
King Solomon said to Abiathar the priest, "I should kill you too, but I will allow you to go back to your fields in Anathoth. I will not kill you at this time, because you helped carry the Ark of the Lord God while marching with my father David. And I know you shared in all the hard times with him."
Then Solomon removed Abiathar from being the Lord's priest. This happened as the Lord had said it would, when he was speaking in Shiloh about the priest Eli and his descendants.
When Joab heard about what had happened, he was afraid. He had supported Adonijah but not Absalom. So Joab ran to the Tent of the Lord and took hold of the corners of the altar.
Someone told King Solomon that Joab had run to the Tent of the Lord and was beside the altar. Then Solomon ordered Benaiah to go and kill him.
Benaiah went into the Tent of the Lord and said to Joab, "The king says, 'Come out!'" But Joab answered, "No, I will die here." So Benaiah went back to the king and told him what Joab had said.
Then the king ordered Benaiah, "Do as he says! Kill him there and bury him. Then my family and I will be free of the guilt of Joab, who has killed innocent people.
Without my father knowing it, he killed two men who were much better than he was -- Abner son of Ner, the commander of Israel's army, and Amasa son of Jether, the commander of Judah's army. So the Lord will pay him back for those deaths.
Joab and his family will be forever guilty for their deaths, but there will be peace from the Lord for David, his descendants, his family, and his throne forever."
So Benaiah son of Jehoiada killed Joab, and he was buried near his home in the desert.
The king then made Benaiah son of Jehoiada commander of the army in Joab's place. He also made Zadok the new high priest in Abiathar's place.
Next the king sent for Shimei. Solomon said to him, "Build a house for yourself in Jerusalem and live there. Don't leave the city.
The very day you leave and cross the Kidron Valley, someone will kill you, and it will be your own fault."
So Shimei answered the king, "I agree with what you say. I will do what you say, my master and king." So Shimei lived in Jerusalem for a long time.
But three years later two of Shimei's slaves ran away to Achish king of Gath, who was the son of Maacah. Shimei heard that his slaves were in Gath,
so he put his saddle on his donkey and went to Achish at Gath to find them. Then he brought them back from Gath.
Someone told Solomon that Shimei had gone from Jerusalem to Gath and had returned.
So Solomon sent for Shimei and said, "I made you promise in the name of the Lord not to leave Jerusalem. I warned you if you went out anywhere you would die, and you agreed to what I said.
Why did you break your promise to the Lord and disobey my command?"
The king also said, "You know the many wrong things you did to my father David, so now the Lord will punish you for those wrongs.
But the Lord will bless me and make the rule of David safe before the Lord forever."
Then the king ordered Benaiah to kill Shimei, and he did. Now Solomon was in full control of his kingdom.