Famine comes to Israel. David seeks God, and He says it's becauseSaul tried to wipe out the Gibeonite, in violation of Israel's oath made by Joshua. David gives them 7 descendants of Saul to execute in retribution. When the mother of some of them mourns publicly in protest, David brings the bones of Saul and Jonathan to their ancestral home and gives them a more honorable burial.
Israel fights the Philistines again, and David is almost killed. He stops going out to fight, but his men carry on well, defeating giants.
Samuel includes a Psalm of David's, the 18th. God delivered me from the distress of enemies foreign and domestic. He fought for me, gave me strength and skill, and subdued foreigners to me. So I will praise Him.
How this is about Jesus
He will bring about perfect justice, whereas now earthly rulers cannot.
He passes on His mission to His followers, though not because He has grown weak.
He praised God for His deliverance and mercy.
When things are going badly, it is good to ask God why? Have I done something wrong?
It is not easy to satisfy conflicting interests, stay faithful to God's Word, and keep your promises to others, all at the same time!