6 And David [Dovid] was greatly distressed; for the people [HaAm] spake of stoning him, because the soul of all the people [nefesh of kol HaAm] was grieved [marah], every man for his sons [ish for his banim] and for his daughters [banot]: but David [Dovid] encouraged himself in Yahweh his Elohim.

Never were David's prospects darker than at this moment. Yet he was on the verge of day-break. 

When the power of weeping had been exhausted, the question what was to be done pressed itself. Pursuit of the marauding band was suggested by David and sanctioned by God. Pursuit resulted in capture and in the recovery of the stolen families. David's troubles were nearing an end. In the midst of the joy of domestic reunion, tidings came of the battle between Israel and the Philistines, the discomfiture of the former, and the death of Saul and his sons in battle.

Ways of Providence Ch 16.

26 And when [Dovid came to Tziklag], he sent of the spoil [shalal (plunder)] unto the elders of Judah [Ziknei Yehudah], even to his friends [re'im], saying, Behold [Hinei] a present [brocha] for you of the spoil [shalal] of the enemies of Yahweh;

What was the wisest thing next to be done in the circumstances? David had adopted the prudent measure of conciliating the heads of the tribe of Judah. He had sent them a present out of the stuff taken from the Amalekites who had burnt Ziklag...This was a discreet paving of the way-not in the nature of bribery, but a legitimate though politic predisposing of the situation for what had been divinely appointed and was evidently impending-the choice of David as Saul's successor. It was an instance of what Saul referred to when he said he was told that David dealt "very subtilly."

Ways of Providence Ch 16