his psalm begins with a clear claim concerning our God: He is our light (I John 1:5 & Psalm 27:1). And, the psalm ends with a definite challenge for us to wait on God (that is, to trust Him instead of rushing on through life without Him). Significantly, we find here that as we wait on God, we have no reason to be afraid (Psalm 27:1-3).
David sure had things straight in his mind when he sat down to write this Psalm. He was conscious of the fact that God was his light. He was sure that waiting on God was the wise way to order one's life. And, in verse 4 he declared that his priority was fellowship with his Lord. David's wholesome desire reminds me of Paul's priority as we find it in Philippians 3:10 & 13-14. There is no substitute for fellowship with the Father (I John 1:3, Romans 5:2 & Ephesians 2:18). So, David perceived God's invitation, and he therefore gladly received it and responded favorably (Psalm 27:8).
It is certain that David wasn't some ascetic hermit writing imaginative poetry in a monastery somewhere far from public scrutiny. David knew what it felt like to have many enemies who were close at hand (Psalm 27:9-12). The hardships of his life were intense (Psalm 27:13). But, David was looking to God as his helper, sustainer, and friend. What a comfort that was to him... and what a comfort the same truths can be for us if we will also look to God (Hebrews 12:2)!