David lived in a world in which he was under assault. He took refuge in God. That means that no matter his circumstances he could spiritually, mentally, emotionally go to God. The facts are that we cannot find refuge in any thing on this earth, not our careers, our marriage, our hobbies, nothing. It is only through God that security can be found.
For the director of music. A psalm of David.
1 In you, Lord, I have taken refuge; let me never be put to shame; deliver me in your righteousness. 2 Turn your ear to me, come quickly to my rescue; be my rock of refuge, a strong fortress to save me. 3 Since you are my rock and my fortress, for the sake of your name lead and guide me. 4 Keep me free from the trap that is set for me, for you are my refuge. 5 Into your hands I commit my spirit; deliver me, Lord, my faithful God.
6 I hate those who cling to worthless idols; as for me, I trust in the Lord. 7 I will be glad and rejoice in your love, for you saw my affliction and knew the anguish of my soul. 8 You have not given me into the hands of the enemy but have set my feet in a spacious place.
9 Be merciful to me, Lord, for I am in distress; my eyes grow weak with sorrow, my soul and body with grief. 10 My life is consumed by anguish and my years by groaning; my strength fails because of my affliction,[b] and my bones grow weak. 11 Because of all my enemies, I am the utter contempt of my neighbors and an object of dread to my closest friends— those who see me on the street flee from me. 12 I am forgotten as though I were dead; I have become like broken pottery. 13 For I hear many whispering, “Terror on every side!” They conspire against me and plot to take my life.
14 But I trust in you, Lord; I say, “You are my God.” 15 My times are in your hands; deliver me from the hands of my enemies, from those who pursue me. 16 Let your face shine on your servant; save me in your unfailing love. 17 Let me not be put to shame, Lord, for I have cried out to you; but let the wicked be put to shame and be silent in the realm of the dead. 18 Let their lying lips be silenced, for with pride and contempt they speak arrogantly against the righteous.
19 How abundant are the good things that you have stored up for those who fear you, that you bestow in the sight of all, on those who take refuge in you. 20 In the shelter of your presence you hide them from all human intrigues; you keep them safe in your dwelling from accusing tongues.
21 Praise be to the Lord, for he showed me the wonders of his love when I was in a city under siege. 22 In my alarm I said, “I am cut off from your sight!” Yet you heard my cry for mercy when I called to you for help.
23 Love the Lord, all his faithful people! The Lord preserves those who are true to him, but the proud he pays back in full. 24 Be strong and take heart, all you who hope in the Lord.