When David ran from Saul, he found himself hiding among enemies (Philistines). It was here that he wrote this song for the fearful and distressed. He taught us what to do with fear. When we are afraid, we should trust in God. Trust turns our fears to faith.
One of the greatest promises we can know when we are surrounded by enemies is, "God is for me" (v.9).