How can this be considering David's behaviour and way of life?
Thank you for asking a question on www.thisisyourbible.com
Paul, by the Holy Spirit, speaks of the testimony of scripture that David was a man after God’s own heart.
Acts 13:22 And when he had removed him (Saul), he raised up unto them David to be their king; to whom also he gave testimony, and said, I have found David the son of Jesse, a man after mine own heart, which shall fulfil all my will.
He is referring to God’s message through Samuel to Saul, chosen as Israel’s first king. Saul had twice disobeyed God’s commandment.
1 Samuel 13:13 And Samuel said to Saul, Thou hast done foolishly: thou hast not kept the commandment of the LORD thy God, which he commanded thee: for now would the LORD have established thy kingdom upon Israel for ever. 14 But now thy kingdom shall not continue: the LORD hath sought him a man after his own heart, and the LORD hath commanded him to be captain over his people, because thou hast not kept that which the LORD commanded thee.
God’s requirement is that men serve him in truth with all their heart as Samuel exhorts Israel.
1 Samuel 12:24 Only fear the LORD, and serve him in truth with all your heart: for consider how great things he hath done for you.
God saw in David a man who would do this.
1 Samuel 16:7 But the LORD said unto Samuel, Look not on his countenance, or on the height of his stature; because I have refused him: for the LORD seeth not as man seeth; for man looketh on the outward appearance, but the LORD looketh on the heart.
Samuel anoints David to be king. Our first glimpse of the kind of man David is begins with Goliath. David is shown to be a man who trusts in his God and is prepared to hazard his life for his people and give God the glory.
1 Samuel 17:32 And David said to Saul, Let no man’s heart fail because of him; thy servant will go and fight with this Philistine. 34... Thy servant kept his father’s sheep, and there came a lion, and a bear, and took a lamb out of the flock: 35 And I went out after him, and smote him, and delivered it out of his mouth: and when he arose against me, I caught him by his beard, and smote him, and slew him. 36 Thy servant slew both the lion and the bear: and this uncircumcised Philistine shall be as one of them, seeing he hath defied the armies of the living God. 37... The LORD that delivered me out of the paw of the lion, and out of the paw of the bear, he will deliver me out of the hand of this Philistine... 45 Then said David to the Philistine, Thou comest to me with a sword, and with a spear, and with a shield: but I come to thee in the name of the LORD of hosts, the God of the armies of Israel, whom thou hast defied. 46 This day will the LORD deliver thee into mine hand; and I will smite thee, and take thine head from thee; and I will give the carcases of the host of the Philistines this day unto the fowls of the air, and to the wild beasts of the earth; that all the earth may know that there is a God in Israel. 47 And all this assembly shall know that the LORD saveth not with sword and spear: for the battle is the LORD’S, and he will give you into our hands.
On the run from a jealous Saul he hazards his life to save Keilah; first enquiring of and then trusting in his God.
1 Samuel 23:1 Then they told David, saying, Behold, the Philistines fight against Keilah, and they rob the threshingfloors. 2 Therefore David enquired of the LORD, saying, Shall I go and smite these Philistines? And the LORD said unto David, Go, and smite the Philistines, and save Keilah. 3 And David’s men said unto him, Behold, we be afraid here in Judah: how much more then if we come to Keilah against the armies of the Philistines? 4 Then David enquired of the LORD yet again. And the LORD answered him and said, Arise, go down to Keilah; for I will deliver the Philistines into thine hand. 5 So David and his men went to Keilah, and fought with the Philistines, and brought away their cattle, and smote them with a great slaughter. So David saved the inhabitants of Keilah.
When Saul is delivered into his hands, he shows mercy; refusing to kill him because Saul is God’s anointed king. His conscience troubles him over cutting off the hem of Saul’s robe in order to demonstrate that Saul has nothing to fear from David.
1 Samuel 24:4 And the men of David said unto him, Behold the day of which the LORD said unto thee, Behold, I will deliver thine enemy into thine hand, that thou mayest do to him as it shall seem good unto thee. Then David arose, and cut off the skirt of Saul’s robe privily. 5 And it came to pass afterward, that David’s heart smote him, because he had cut off Saul’s skirt. 6 And he said unto his men, The LORD forbid that I should do this thing unto my master, the LORD’S anointed, to stretch forth mine hand against him, seeing he is the anointed of the LORD. 7 So David stayed his servants with these words, and suffered them not to rise against Saul.
When Saul is delivered into his hand the second time he again extends mercy and refuses to kill him. He sees that the right thing to do is to leave Saul in the hands of God.
1 Samuel 26:7 So David and Abishai came to the people by night: and, behold, Saul lay sleeping within the trench, and his spear stuck in the ground at his bolster: but Abner and the people lay round about him. 8 Then said Abishai to David, God hath delivered thine enemy into thine hand this day: now therefore let me smite him, I pray thee, with the spear even to the earth at once, and I will not smite him the second time. 9 And David said to Abishai, Destroy him not: for who can stretch forth his hand against the LORD’S anointed, and be guiltless? 10 David said furthermore, As the LORD liveth, the LORD shall smite him; or his day shall come to die; or he shall descend into battle, and perish. 11 The LORD forbid that I should stretch forth mine hand against the LORD’S anointed:
Romans 12:19 Dearly beloved, avenge not yourselves, but rather give place unto wrath: for it is written, Vengeance is mine; I will repay, saith the Lord.
Saul dies for his disobedience but not by the hand of David.
1 Chronicles 10:13 So Saul died for his transgression which he committed against the LORD, even against the word of the LORD, which he kept not, and also for asking counsel of one that had a familiar spirit, to enquire of it;
David, established in his kingdom is concerned to build a house for the Ark of the Covenant; a place for God to dwell (symbolically) with Israel.
Acts 7... unto the days of David; 46 Who found favour before God, and desired to find a tabernacle for the God of Jacob.
2 Samuel 7:1 And it came to pass, when the king sat in his house, and the LORD had given him rest round about from all his enemies; 2 That the king said unto Nathan the prophet, See now, I dwell in an house of cedar, but the ark of God dwelleth within curtains. 3 And Nathan said to the king, Go, do all that is in thine heart; for the LORD is with thee. 4 And it came to pass that night, that the word of the LORD came unto Nathan, saying, 5 Go and tell my servant David, Thus saith the LORD, Shalt thou build me an house for me to dwell in? 6 Whereas I have not dwelt in any house since the time that I brought up the children of Israel out of Egypt, even to this day, but have walked in a tent and in a tabernacle. 7 In all the places wherein I have walked with all the children of Israel spake I a word with any of the tribes of Israel, whom I commanded to feed my people Israel, saying, Why build ye not me an house of cedar? 8 Now therefore so shalt thou say unto my servant David, Thus saith the LORD of hosts, I took thee from the sheepcote, from following the sheep, to be ruler over my people, over Israel: 9 And I was with thee whithersoever thou wentest, and have cut off all thine enemies out of thy sight, and have made thee a great name, like unto the name of the great men that are in the earth. 10 Moreover I will appoint a place for my people Israel, and will plant them, that they may dwell in a place of their own, and move no more; neither shall the children of wickedness afflict them any more, as beforetime, 11 And as since the time that I commanded judges to be over my people Israel, and have caused thee to rest from all thine enemies. Also the LORD telleth thee that he will make thee an house. 12 And when thy days be fulfilled, and thou shalt sleep with thy fathers, I will set up thy seed after thee, which shall proceed out of thy bowels, and I will establish his kingdom. 13 He shall build an house for my name, and I will stablish the throne of his kingdom for ever. 14 I will be his father, and he shall be my son. If he commit iniquity, I will chasten him with the rod of men, and with the stripes of the children of men: 15 But my mercy shall not depart away from him, as I took it from Saul, whom I put away before thee. 16 And thine house and thy kingdom shall be established for ever before thee: thy throne shall be established for ever.
God gives him a promise of a kingdom that will be established forever in which David will be present (by resurrection from the dead). The promise has a long term fulfilment in David’s greater son; the Messiah. This restored kingdom of David will be the promised kingdom of God. Christ will rule the earth from Jerusalem when he returns.
Luke 1:31 And, behold, thou shalt conceive in thy womb, and bring forth a son, and shalt call his name JESUS. 32 He shall be great, and shall be called the Son of the Highest: and the Lord God shall give unto him the throne of his father David: 33 And he shall reign over the house of Jacob for ever; and of his kingdom there shall be no end.
Acts 3:21 Whom the heaven must receive until the times of restitution of all things, which God hath spoken by the mouth of all his holy prophets since the world began.
David’s character is shown in his treatment of Shimei who falsely accuses him of being responsible for the death of Saul and his sons.
2 Samuel 16:5 And when king David (fleeing form Absalom) came to Bahurim, behold, thence came out a man of the family of the house of Saul, whose name was Shimei, the son of Gera: he came forth, and cursed still as he came. 6 And he cast stones at David, and at all the servants of king David: and all the people and all the mighty men were on his right hand and on his left. 7 And thus said Shimei when he cursed, Come out, come out, thou bloody man, and thou man of Belial: 8 The LORD hath returned upon thee all the blood of the house of Saul, in whose stead thou hast reigned; and the LORD hath delivered the kingdom into the hand of Absalom thy son: and, behold, thou art taken in thy mischief, because thou art a bloody man. 9 Then said Abishai the son of Zeruiah unto the king, Why should this dead dog curse my lord the king? let me go over, I pray thee, and take off his head. 10 And the king said, What have I to do with you, ye sons of Zeruiah? so let him curse, because the LORD hath said unto him, Curse David. Who shall then say, Wherefore hast thou done so? 11 And David said to Abishai, and to all his servants, Behold, my son, which came forth of my bowels, seeketh my life: how much more now may this Benjamite do it? let him alone, and let him curse; for the LORD hath bidden him. 12 It may be that the LORD will look on mine affliction, and that the LORD will requite me good for his cursing this day.
On David’s return after Absalom’s death:
2 Samuel 19:21 But Abishai the son of Zeruiah answered and said, Shall not Shimei be put to death for this, because he cursed the LORD’S anointed? 22 And David said, What have I to do with you, ye sons of Zeruiah, that ye should this day be adversaries unto me? shall there any man be put to death this day in Israel? for do not I know that I am this day king over Israel?
We are shown how Solomon with his God-given wisdom differed from David.
1 Kings 11:4 For it came to pass, when Solomon was old, that his wives turned away his heart after other gods: and his heart was not perfect with the LORD his God, as was the heart of David his father. 5 For Solomon went after Ashtoreth the goddess of the Zidonians, and after Milcom the abomination of the Ammonites. 6 And Solomon did evil in the sight of the LORD, and went not fully after the LORD, as did David his father.
Under Solomon Israel turned to idolatry and the kingdom was split when Rehoboam came to the throne.
1 Kings 11:33 Because that they have forsaken me, and have worshipped Ashtoreth the goddess of the Zidonians, Chemosh the god of the Moabites, and Milcom the god of the children of Ammon, and have not walked in my ways, to do that which is right in mine eyes, and to keep my statutes and my judgments, as did David his father.
David becomes a benchmark for the behaviour of the kings.
1 Kings 14:8 And rent the kingdom away from the house of David, and gave it thee (Jeroboam): and yet thou hast not been as my servant David, who kept my commandments, and who followed me with all his heart, to do that only which was right in mine eyes; 9 But hast done evil above all that were before thee: for thou hast gone and made thee other gods, and molten images, to provoke me to anger, and hast cast me behind thy back:
1 Kings 15:3 And he (Abijam) walked in all the sins of his father, which he had done before him: and his heart was not perfect with the LORD his God, as the heart of David his father. 4 Nevertheless for David’s sake did the LORD his God give him a lamp in Jerusalem, to set up his son after him, and to establish Jerusalem: 5 Because David did that which was right in the eyes of the LORD, and turned not aside from any thing that he commanded him all the days of his life, save only in the matter of Uriah the Hittite.
Here we have God’s testimony that David obeyed God all his life except in the matter of Bathsheba and Uriah. We might reasonably conclude that God showed David the mercy that David had first shown to Saul.
2 Samuel 22:26 With the merciful thou wilt shew thyself merciful, and with the upright man thou wilt shew thyself upright.
Matthew 5:7 Blessed are the merciful: for they shall obtain mercy.
James 2:13 For he shall have judgment without mercy, that hath shewed no mercy; and mercy rejoiceth against judgment.
It is the mercy demonstrated to David and promised to his offspring that is part of the New Covenant in Christ.
Isaiah 55:3 Incline your ear, and come unto me: hear, and your soul shall live; and I will make an everlasting covenant with you, even the sure mercies of David.
Acts 13:34 And as concerning that he raised him up from the dead, now no more to return to corruption, he said on this wise, I will give you the sure mercies of David.
Hebrews 10:16 This is the covenant that I will make with them after those days, saith the Lord, I will put my laws into their hearts, and in their minds will I write them; 17 And their sins and iniquities will I remember no more.
To return to David as a benchmark for the kings:
1 Kings 15:11 And Asa did that which was right in the eyes of the LORD, as did David his father.
2 Kings 16:2 Twenty years old was Ahaz when he began to reign, and reigned sixteen years in Jerusalem, and did not that which was right in the sight of the LORD his God, like David his father.
2 Kings 14:3 And he (Amaziah) did that which was right in the sight of the LORD, yet not like David his father: he did according to all things as Joash his father did.
2 Kings 18:3 And he (Hezekiah) did that which was right in the sight of the LORD, according to all that David his father did.
2 Kings 22:2 And he (Josiah) did that which was right in the sight of the LORD, and walked in all the way of David his father, and turned not aside to the right hand or to the left.
This is God’s testimony of David’s quality in Psalm 78.
Psalms 78:70 He chose David also his servant, and took him from the sheepfolds: 71 From following the ewes great with young he brought him to feed Jacob his people, and Israel his inheritance. 72 So he fed them according to the integrity of his heart; and guided them by the skilfulness of his hands.
In Ezekiel’s prophecy of Israel’s final restoration, David is used as a cipher for Christ.
Ezekiel 34:23 And I will set up one shepherd over them, and he shall feed them, even my servant David; he shall feed them, and he shall be their shepherd. 24 And David my servant shall be king over them; and they all shall have one shepherd: they shall also walk in my judgments, and observe my statutes, and do them. 25 And they shall dwell in the land that I have given unto Jacob my servant, wherein your fathers have dwelt; and they shall dwell therein, even they, and their children, and their children’s children for ever: and my servant David shall be their prince for ever.
Similarly in Hosea:
Hosea 3:5 Afterward shall the children of Israel return, and seek the LORD their God, and David their king; and shall fear the LORD and his goodness in the latter days.
There is more, as a lot is written about David, but this should be sufficient to demonstrate why God describes David as a man after his own heart.
I hope you have found this helpful.
May God bless you,