2 Samuel 22:1
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: 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:
This verse introduces a song that David composed while Saul was pursuing him and trying to take his life. That composing took place during David's trials in the wilderness, when God repeatedly preserved him. The song recounts David's dangers and deliverances and gives praise and glory to God as his merciful preserver for delivering him from Saul and all his enemies. It shows his unwavering trust in God through severe trials and hardships. It also shows his devotion to divine things.