David sang to the Lord the words of this song when the Lord delivered him from the hand of all his enemies and from the hand of Saul.