As God stood by David in his duel with Goliath, so he stood by him in many other of his difficulties. Often when he thought all hope lost, the arm of God suddenly succored him, and in unexpected ways, not only bringing relief, but also conveying instruction on God's wise and just guidance of the world.
David once said to God: "The world is entirely beautiful and good, with the one exception of insanity. What use does the world derive from a lunatic, who runs hither and thither, tears his clothes, and is pursued by a mob of hooting children?" "Verily, a time will come," said God in reply, "when thou wilt supplicate me to afflict thee with madness." Now, it happened when David, on his flight before Saul, came to Achish, the king of the Philistines, who lived in Gath, that the brothers of Goliath formed the heathen king's body-guard, and they demanded that their brother's murderer be executed. Achish, though a heathen, was pious, for which reason he is called Abimelech in the Psalms, after the king of Gerar, who also was noted for piety. He therefore sought to pacify David's enemies. He called their attention to the fact that Goliath had been the one to challenge the Jews to combat, and it was meet, therefore, that he should be left to bear the consequences. The brothers rejoined, if that view prevailed, then Achish would have to give up his throne to David, for, according to the conditions of the combat, the victor was to have dominion over the vanquished as his servants. In his distress, David besought God to let him appear a madman in the eyes of Achish and his court. God granted his prayer. As the wife and daughter of the Philistine king were both bereft of reason, we can understand his exclamation: "Do I lack madmen, that ye have brought this fellow to play the madman in my presence?" Thus it was that David was rescued. Thereupon he composed the Psalm beginning with the words, "I will bless the Lord at all times," which includes even the time of lunacy.