Wait on the LORD: be of good courage, and he shall strengthen thine heart: wait, I say, on the LORD. (Psalm 27:14)

In "Biblical Perspective" Gordon Snider writes:

This closing exhortation may have been self-talk, the psalmist’s instructions to others based upon what he had just experienced, or the words of a third party to the psalmist. It concludes a Psalm characterized by imperatives with three more. Wait on the LORD suggests the idea of “Don’t give up.” This is active waiting — with expectation and hope, not resignation and exasperation. Be of good courage could be paraphrased, “Be tough.” Christians are not soft-skinned weaklings. They are warriors who must expect the adversities of battle. But in the battle we must not forget our resources. He shall strengthen thine heart. There is an interesting parallel in these two lines. God is said to do for us what we are commanded to do for ourselves.

Source: Studies in the Psalms: Adult Teacher's Insights, page 25.