David declares his trust in the Lord in dangerous times. David had no doubt concerning God’s sovereign protection. David had a close personal relationship with the Lord. Nothing in his life was kept from the Lord, but rather he spoke to God as one speaks to a closer friend. Therefore, when he found himself surrounded by the wicked, it was natural for him to go to God, knowing that God would intercede on his behalf. David knew that God is a just judge, who is angry with the wicked.
David learned that victory from his enemies, no matter who they were, must come from God Himself. Apart from God, David was helpless before even the weakest of enemies. Such was the case, David was not only willing to submit to God’s chastisement, he encouraged it. He knew he was better off in God’s hands.
David expresses his gratitude to the Lord and praises Him for whatever He chooses to do; no matter what it is, it’s always consistent with God’s perfect will and righteousness. He praises God for vindicating him and making him king.