And David spake unto the Lord the words of this song in the day [that] the Lord had delivered him out of the hand of all his enemies, and out of the hand of Saul.] (See Gill on Psalms 18:1).