Maschil of David; A Prayer when he was in the cave. Of the word "maschil", See Gill on Psa 32:1, title. This psalm is called a prayer, as some others are, the ninetieth and hundred second psalms: and was composed by David when either in the cave of Adullam, Sa1 22:1; or rather in the cave at Engedi, where he cut off Saul's skirt, Sa1 24:3; as Jarchi and Kimchi think. The psalm represents the troubles of David, and of the Messiah his antitype, and is applicable to the church of God, or to any particular soul when in distress.

I cried unto the Lord with my voice,.... With the voice of his soul, in the language of his mind, mentally, as Moses and Hannah cried unto the Lord when no voice was heard, or articulate sounds expressed, since this prayer was put up to the Lord in the cave where Saul was; though it might have been delivered before he came into it, while he and his men were at the mouth of it, which threw David into this distress; besides the cave was so large as to hold David and his six hundred men without being seen by Saul, and who could discourse together, as David and his men did, without being heard by Saul while he was in it; and so this psalm or prayer might be spoken vocally, though he was there;

with my voice unto the Lord did I make, my supplication: the same thing in other words; "crying" is explained by making "supplication", which is praying to the Lord in an humble manner for grace and mercy, and not pleading merit and worthiness.

I poured out my complaint before him,.... Not a complaint of the Lord and of his providences, but of himself; of his sins, and particularly his unbelief; and also of them that persecuted and afflicted him; which he "poured" out from the abundance of his heart, and in the bitterness of his soul; denoting the fulness of his prayer, his freedom in it, the power and fervency of it, and which he left before the Lord, and submitted to his will; see Psa 102:1, title;

I showed before him my trouble; the present trouble he was in, being pursued and surrounded by Saul and his army; not as if the Lord was ignorant of it, and did not see and observe it, but to affect his own soul with it, to exercise grace under it, and ease his burdened and distressed mind; the best of men have their troubles both within and without, and the way to be rid of them is to carry them to the Lord.

When my spirit was overwhelmed within me,.... Ready to sink and faint under the present affliction, being attended with the hidings of God's face, and with unbelieving frames; which is sometimes the case of God's people, and with which they are as it were covered and overwhelmed, as well as with a sense of sin, and with shame and sorrow for it; see Psa 61:2;

then thou knewest my path: the eyes of the Lord are upon all men, and he knows their goings, none of them are hid from him; and he sees and approves of the way, of the life and conversation of his people in general; and particularly observes what way they take under affliction, which is to apply to him for help and deliverance, Psa 1:6. R. Moses in Aben Ezra and Kimchi interpret it of the path he walked in, which was right and not evil, for which he could appeal to God, that knows all things; it may literally intend the path David took to escape the fury of Saul, that pursued him from place to place;

in the way wherein I walked have they privily laid a snare for me; let him take which way he would, there were spies upon him, or men that were in ambush to take him; and snares were everywhere laid for him to entrap him; see Psa 140:5.

I looked on my right hand, and beheld,.... On the left, so Kimchi supplies it, and after him Piscator; he looked about him every way to the right and left, to see if he could get any help, or find out any way of deliverance. To this sense the Targum, Septuagint, Vulgate Latin, Syriac, and Arabic versions render the words; and so Kimchi and Aben Ezra understand them: but some render them in the imperative, "look on the right hand, and behold" (n); and consider them; either as spoken to his own soul, to stir up himself to look around him for help and relief; or as an address to God, to look and behold, as in Psa 80:14; and R. Obadiah reads them, "look, O right hand"; O right hand of God, that does valiantly: but looking cannot properly be ascribed to the right hand; and besides it is not the Lord the psalmist is speaking to, or looking after, but men, as follows;

but there was no man that would know me; take notice of him, and acknowledge and own him, or show him any favour, or even own that they had any knowledge of him; which is often the case when men are in affliction and distress, their former friends, acquaintance, yea, relations, keep at a distance from them; so it was with Job, the Messiah, and others; see Job 19:13;

refuge failed me; as he could get no help from men, so there was no way open for his escape, or by which he could flee and get out of the hands and reach of his enemies; in these circumstances he was when in the cave;

no man cared for my soul; or "life" (o); to save it, protect and defend it, that is, very few; otherwise there were some that were concerned for him, as the men that were with him, and Jonathan, Saul's son; but none of Saul's courtiers, they were not solicitous for his welfare, but on the contrary sought his life, to take it away. This is an emblem of a soul under first awakenings and convictions, inquiring the way of salvation, and where to find help, but at a lois for it in the creature.

I cried unto thee, O Lord,.... Finding no help from man, he turns to the Lord, and directs his prayer to him in his distress;

I said, thou art my refuge; as he was, from all his enemies that were in pursuit of him, and from the storm of calamities he apprehended was coming upon him: and a refuge the Lord is to all his people in time of trouble; and where they always meet with sustenance, protection, and safety; he being a strong habitation, a strong hold, a strong refuge, to which they may resort at all times; and such is Christ to all sensible sinners that flee unto him, Heb 6:18;

and my portion in the land of the living; and a most excellent one he is, a large, immense, and inconceivable portion; he and all his perfections, purposes, promises, and blessings, being included in it; a soul-satisfying one, and which will never be taken away nor consumed; it is a portion in the present life; it will last as long as life lasts, and continues unto death, and at death, and for evermore, Psa 73:26.

Attend unto my cry,.... His prayer and supplication for help in his distress, which he desires might be hearkened unto and answered;

for I am brought very low; in his spirit, in the exercise of grace, being in great affliction, and reduced to the utmost extremity, weakened, impoverished, and exhausted; wanting both men and money to assist him, Psa 79:8;

deliver me from my persecutors; Saul and his men, who were in pursuit of him with great warmth and eagerness;

for they are stronger than I; more in number, and greater in strength; Saul had with him three thousand chosen men out of all Israel, ablebodied men, and expert in war; veteran troops, and in high spirits, with their king at the head of them; David had about six hundred men, and these poor mean creatures, such as were in distress, in debt, and discontented, and in want of provisions, and dispirited; see Sa1 22:2. So the spiritual enemies of the Lord's people are stronger than they, Jer 31:11.

Bring my soul out of prison,.... Not out of purgatory, to which some Popish writers wrest these words very absurdly; nor out of the prison of his body, as Joseph Ben Gorion (p); knowing that none but God had a power of removing it from thence; but out of the cave, where he was detained as in a prison, while Saul and his men were about the mouth of it; or rather out of all his straits, distresses, and difficulties, which surrounded and pressed him on all sides, as if he was in a prison;

that I may praise thy name; this release he desired not so much for his own sake, that he might be at ease and liberty, but that he might have fresh occasion to praise the Lord, and an opportunity of doing it publicly, in the assembly and congregation of the people;

the righteous shall compass me about; in a circle, like a crown, as the word (q) signifies; when delivered, they should flock to him and come about him, to see him and look at him, as a miracle of mercy, whose deliverance was marvellous; and to congratulate him upon it, and to join with him in praises unto God for it. The Targum is,

for thou shalt deal bountifully with me; in delivering him from his enemies, settling him on the throne, and bestowing upon him all the blessings of Providence and grace; see Psa 116:7; and thus the psalm is concluded with a strong expression of faith in the Lord, though in such a low estate.