The following psalm cannot so properly be said to consist of prayers as of a variety of pious meditations, which comforted the mind of David under dangers, anxieties, and troubles of a severe description. It contains the vows too which he made to God in the distress occasioned by the alarming circumstances in which he was placed.
A Psalm of David, when he was in the wilderness of Judah.1
1 David was often compelled to flee into the remote deserts which lay in the tribe of Judah, to escape the fury of Saul. In tracing his steps, when eagerly sought after by this relentless persecutor, we find him in the forest of Hareth, and in the wildernesses of Ziph, Maon, and Engedi, all in the tribe of Judah. See 1 Samuel 22:5; 23:14, 24, 25; 24:1; and Joshua 15:55, 62. The only objection which can be made to referring the occasion of the composition of this psalm to David's persecution by Saul is, that in the 11th verse, David is called king; whereas Saul still swayed the scepter over Israel. But, as Calvin observes on that verse, David may have called himself by this title to express his confident persuasion that God would raise him to the throne in fulfillment of his promise; and his followers might call him king even during Saul's lifetime, though he was not acknowledged to be sovereign by any tribe till after Saul fell at Gilboa. It is, however, supposed by some that the psalm was written during the rebellion of his son Absalom, when he was under the necessity of quitting Jerusalem, and escaping into the wilderness, 2 Samuel 15:23; 16:2; and 17:29.