2 Samuel 20…Like Disciples today David was not perfect. When he sinned with Bathsheba and murdered her husband he was tormented for a year or so until confronted by Nathan. David confessed that he had sinned against God and God forgave him but said: “the sword will never depart from your house”.
Afterward I believe that David primarily acted with humility, honesty, and recognition of his own sins and that he could not escape the consequences. Therefore, he left the correction of his children and subordinates to God. He gave loyalty and trust to his King, the Lord God. He acted with humility when he left Jerusalem as Absalom deposed David. Read Psalm 55 that might have been written by David because of the betrayal of his trusted advisor, Ahithophel.
David is specifically noted as the author of 73 psalms in the titles of the psalms and in 2 scripture in the NT. AA
You cannot read these Psalms and David’s story in the Bible without acknowledging the following: David was  filled with the Spirit continually just like we are today, had an intimate relationship with God and was a student of God’s word,  humble,  sufferring greatly as a result of his sins,  not stubborn, demanding his own way, but yielding to others,  did not try to impose his will on others,  recognized that many of his problems resulted from his sin,  aware his family members and associates who sinned or betrayed God and him had to learn for themselves and were responsible for their actions,  knowing that he could not escape the consquences of his sin but could be kind, patient, trusting in God,  kind to Jonathan’s crippled son,  welcoming of non-Israelite tribe members into his army, fulfilling the command to be a nation of priests to the outside world A,  aware that his kingdom would endure forever. This was fulfilled by the birth of Jesus from his descendants and today by His spiritual descendants,  David is one 16 OT people listed by name in the hall of game in Hebrews 11. B
Therefore, I believe David was primarily a protagonist-hero for God though he did not finish as strong as desired! What can you learn from David’s humility to improve as a protagonist-hero for Jesus and to finish strong? What can sinners today do to finish strong?
Notes: AA- These include Psalms 3—9; 11—41; 51—65; 68—70; 86; 101; 103; 108—110; 122; 124; 131; 133; and 138—145. In addition, he is credited in the NT with 2 more; Psalm 2 is attributed to David in Acts 4:25, and Psalm 95 is attributed to David in Hebrews 4:7.
A- Examples of people outside the 12 tribes of Judah with David: Cherethites and Pelethites [2 Samuel 15:18, 20:23], Ittai the Gittite [2 Samuel 15:19-22, 18:2] A nation of priests first the Israelites then today’s Disciples [Exodus 19:6, Matthew 21:43,1 Peter 2:5, Matthew 28:19-20, Acts 1:8], Uriah the Hittite [2 Samuel 23:8, 39… 8 These are the names of the mighty men whom David had:…39 Uriah the Hittite; thirty-seven in all]
B- In addition to the 16 named in Hebrews 11, eleven other heros of faith are implied but not named, including Moses parents [11:23], Daniel, Jeremiah, Hezekiah, Zechariah, Isaiah, Shadrich, Meshach, Abednego, widow of Zarerphasth, etc. [11:32d-38]