A festive song of thanksgiving emerges as a summary of a life filled with relentless struggles, grave dangers, and divine rescues. It marks a profound transition from years of wandering and persecution into a period of deep spiritual reflection, rest, and peace. David earned the title of God's servant because he channeled all his strength, focus, and trust toward God in every aspect of his life, much like a servant who constantly looks to his master for guidance [רד״ק, מאירי]. Through this unwavering reliance, he carefully followed God's paths [אבן עזרא]. This title also points to a profound spiritual rescue. While his given name reflects the physical salvation of his body from death, being known as a servant highlights how God protected him from sin, allowing him to remain completely faithful [אלשיך].
The exact timing of this song of gratitude is a subject of discussion. The primary approach among commentators is that David composed it in his old age, after his troubles had passed and God had granted him peace from his wars. Others suggest the timing refers to the general period of his life when he experienced salvation [ביאור שטיינזלץ]. Another view proposes that he sang this song repeatedly, bringing it forth every time he was rescued from a new crisis [מצודת דוד]. It is also linked to the specific moment when David made his men swear that he would no longer go out to battle alongside them [אבן עזרא].
When recounting his rescues, David specifically separates King Saul from the rest of his adversaries. Commentators explain that Saul was his most severe and relentless pursuer, posing a threat so massive that it equaled the danger of all the other enemies combined [רש״י, רד״ק, מאירי, מלבי״ם]. A deeper perspective reveals a difference in the type of threat. While the surrounding nations posed a strictly physical danger, the conflict with Saul carried a dual threat. David faced the physical danger of being killed, alongside the severe spiritual danger of sinning by striking down God's anointed king. The rescue from Saul was ultimately the greatest salvation because David survived without spilling innocent blood. Once he was entirely free from Saul's pursuit, he could sing this song of gratitude for all his enemies at once [אלשיך].
Throughout his life, David experienced God's guiding hand in three distinct ways. He received protection during times of peace to prevent disaster from striking, experienced natural rescues as a direct result of his prayers, and witnessed open, supernatural miracles granted in the merit of his righteous actions [מלבי״ם].
This same song of gratitude is also recorded in the Book of Samuel, though with slight variations in the wording [רד״ק, מנחת שי]. These changes are not accidental. They reflect the different spiritual states in which the song was expressed. The version recorded in Samuel was spoken from the highest level of direct prophecy, whereas the version placed in the Book of Psalms is formulated through the level of the holy spirit [חומת אנך].