The superscription to Psalm 18 says that David “spoke to Jehovah the words of this song in the day that Jehovah had delivered him... out of the hand of Saul. ”
وَإِلَى مَنْ نَسَبَ دَاوُدُ ٱلْفَضْلَ فِي إِنْقَاذِهِ ؟‏