After a lifetime marked by fierce storms, bloody conflicts, and relentless pursuit, King David finally reaches a state of rest and relative quiet. From this place of peace, he offers a grand song of praise to God, thanking Him for His protection, redemption, and the ways He elevated him. The primary approach among commentators is that David composed this song in his old age, at the very end of his life, after he had survived all his hardships and outlasted his foes [רש״י, רד״ק, מצודת דוד, צאינה וראינה, ביאור שטיינזלץ]. Conversely, another perspective suggests that David actually authored the song in his youth, right in the middle of his deepest struggles. According to this view, the song functioned as a general expression of gratitude, and David would sing it anew every single time God rescued him from a fresh crisis [אברבנאל, מלבי״ם, מצודת דוד].
As David reflects on being saved from the grip of all his adversaries, King Saul is notably singled out from the rest. The separation of Saul from the general category of David's enemies raises a question, as one might expect him to be included among them. The accepted explanation is that Saul was David's most formidable pursuer, and the sheer danger he posed was equal to that of all other enemies combined [רש״י, רד״ק, אברבנאל]. Furthermore, the conflict with Saul carried a completely different nature than David's wars against foreign nations. In battle against other nations, David feared only for his own survival. However, while fleeing from Saul, he carried a double burden of fear: the terror of being killed, coupled with the dread that he might be forced to kill God's anointed king or fellow Jews [אלשיך]. Additionally, David never truly viewed Saul as an enemy. He strictly guarded himself against hating Saul in his heart, adhering to the Torah's command, whereas he clearly defined the hostile foreign nations as true adversaries [אברבנאל].
This great song of praise is recorded a second time in the Book of Psalms, though with numerous changes in both words and phrasing. Commentators offer two main paths to understand why these variations exist. The first approach explains the differences through the purpose of the texts. While the version recorded in the Book of Samuel captures David's personal and historical song, he later edited the Book of Psalms in his old age to serve as a universal prayer book for anyone facing distress. Therefore, he deliberately altered specific details so the words would resonate with the needs of individuals seeking comfort in every future generation [אברבנאל, מלבי״ם]. The second approach attributes the differences to the spiritual levels at which the songs were expressed. According to this concept, the original song was spoken from a place of personal awakening or at the level of standard prophecy. The version in Psalms, however, was polished and refined when the Holy Spirit rested upon him, elevating him to a spiritual height that allowed him to grasp the deepest inner secrets of divine wisdom [אלשיך, חומת אנך, אהבת יהונתן, צוארי שלל].