David does not give any indication as to when he composed Psalm 31. Nonetheless, it seems clear that he wrote it while running from an enemy. The commentators assume that it was written as David was fleeing from Saul, after being betrayed by the people of Keilah and then again by the inhabitants of the Wilderness of Ziph (I Samuel 23).
Though David was a man of faith, as a result of this difficult experience in his life his faith seems to undergo a transition. Psalm 31 is the story of faith that was shaken, renewed and transformed.
The psalm can be divided into four parts. The first part of the psalm (eight verses and sixty-three words) explains the incredible faith that the psalmist had in God: “I seek refuge in You, God; may I never be disappointed; as You are righteous, rescue me.” (verse 2); “Into Your hand, I entrust my spirit; You redeem me, God, faithful God” (verse 6).
In the first section the psalmist’s faith is based on his feelings of entitlement to God’s salvation. Since he knows that God is righteous and faithful, He is confident that God will always save him. This type of faith, however, does not last when he is overcome with troubles.
The next five verses of the psalm describe the psalmist’s sorrow, which approaches despair: “Have mercy on me, God, for I am in distress; my eyes are wasted by vexation, my substance and body too” (verse 10) ; “I hear the whisperings of many, intrigue on every side, as they scheme together against me, plotting to take my life” (verse 14). In this section, God is only addressed in the first of these five verses. Slowly, hopelessness takes over and God is removed from his consciousness.
In the third part of the psalm (eight verses and sixty-two words), the psalmist rediscovers his faith. “Show favor to your servant; as You are faithful, deliver me” (verse 17); “Blessed is the LORD, for He has been wondrously faithful to me, a veritable bastion.” (verse 22). In this section, God’s salvation is not taken for granted. Rather, the psalmist appreciates God’s kindness and faithfulness.
In the third section, the psalmist reflects on what has occurred to him. He realizes that he lost hope in God due to his mistaken expectation. He misinterpreted God not answering his prayers immediately as a lack of care on God’s part. However, in contrast to his prayers of entitlement, when he truly prayed out of need his prayers were answered. Through this reflection, the psalmist realizes what it means to have true faith in God.
The fourth and final part of the psalm is a verse of encouragement to “all you who wait for God”: “Be strong and of good courage” (verse 25). The words “Be strong and of good courage” are usually reserved for leaders whose leadership begins a new era in Jewish history. When Joshua was selected to lead the people into the Land of Israel, God and Moshe encouraged him with these words (Deuteronomy 31). Likewise, at the commencement of the Davidic dynasty, David uses these words to encourage Solomon (I Chronicles 28).
Why does David use these words here? According to the medieval commentator known as Rashi, David is encouraging others by saying that his salvation from his many troubles should serve as inspiration and encouragement for all those who are waiting for God. Just as David acquired a new understanding of God over time, the “ones who wait for God” begin a new stage in their relationship with Him as well. Instead of expecting instant answers and miracles, they realize that God can choose to acquiesce to our prayers but isn’t compelled to do so. This new understanding may require an adjustment of thinking and expectations, something they might find difficult or challenging. Therefore, the psalmist ends with the encouragement “Be strong and of good courage!”
David’s psalms, though written in response to his own personal experience, contain timeless messages for all of us. If we take the lesson of this psalm to heart, it will strengthen our faith in God as well. With this sophisticated understanding of how God works, we understand that God is always on our side, even if we don’t get the answers we want in the time that we expect them.