This psalm David wrote regarding his experience after he fled from Saul as recorded in 1 Samuel 21. David’s first stop was to see the priest, Ahimelech, who gave him food and Goliath’s sword.
David’s next stop was the city of Gath, a Philistine town and natural enemy of Israel. The king of the city was named Achish, but David referred to him as Abimelech in the description of this psalm. Abimelech meant “father of the king” among the Philistines according to one source; it was a title rather than a name. The kings military officers were very suspicious of David and questioned David’s motives making him fearful for his safety.
David didn’t know what to do so he prayed, and God gave him the idea of acting like an insane person. The king recognized the symptoms, having people with mental problems in his city, and dismissed the idea of killing David. David then went to a cave where he lived for some time.
David described in the psalm, “in my desperation I prayed, and the Lord listened; He saved me from all my troubles. For the Angel of the Lord is a guard; He surrounds and defends all who fear Him.” When we read in the Old Testament about the Angel of the Lord, this is believed to be what is called an “Theophany”, an appearance of God the Son before He became a human baby in Bethlehem.
David continues in this psalm to describe how God takes care of His people. He said that no matter how hard times get, God will supply the needs of His people (verse 9). In verse 15, he states, “The eyes of the Lord watch over those who do right; His ears are open to their cries for help” (NLT). There are many assurances of God’s blessing His people in this psalm for it was God Who inspired David to write it.