Psalm 40:2 (ESV)

2 He drew me up from the pit of destruction, out of the miry bog, and set my feet upon a rock, making my steps secure.

The reference to the Lord drawing the speaker up from the pit of destruction is a strong image which shows the bad situation he was in. He was close to dying. He is saved just in time. The next image shows the precarious situation in which he is. The Lord saved the speaker from the miry bog. This reminds us of the power of a morass or quicksand. Imagine you stepped in it, and you continue to sink deeper and deeper. You see your demise coming closer. And then you realize, I cannot escape this on my own; I need help from outside. There are two biblical examples of people in a pit, namely, Joseph and Jeremiah.

The Lord pulled the speaker from the bog and set his feet on a rock. Over against the mud, the rock is very sturdy. You do not sink down when you stand on a rock. These are all images of the threat of losing God over against his faithful salvation from death to life. The image of God as a rock occurs very often, for example, in Deuteronomy 32:4, The Rock, his work is perfect, for all his ways are justice. A God of faithfulness and without iniquity, just and upright is he, or Psalm 62:7, On God rests my salvation and my glory; my mighty rock, my refuge is God. With the New Testament in hand, we may think of Christ as our rock.