We are to take notice of the goodness of God towards prisoners and captives. Observe, 1. A description of this affliction. Prisoners are said to sit in darkness (Ps. 107:10), in dark dungeons, close prisons, which intimates that they are desolate and disconsolate; they sit in the shadow of death, which intimates not only great distress and trouble, but great danger. Prisoners are many times appointed to die; they sit despairing to get out, but resolving to make the best of it. They are bound in affliction, and many times in iron, as Joseph. Thus sore a calamity is imprisonment, which should make us prize liberty, and be thankful for it. 2. The cause of this affliction, Ps. 107:11. It is because they rebelled against the words of God. Wilful sin is rebellion against the words of God; it is a contradiction to his truths and a violation of his laws. They contemned the counsel of the Most High, and thought they neither needed it nor could be the better for it; and those that will not be counselled cannot be helped. Those that despise prophesying, that regard not the admonitions of their own consciences nor the just reproofs of their friends, contemn the counsel of the Most High, and for this they are bound in affliction, both to punish them for and to reclaim them from their rebellions. 3. The design of this affliction, and that is to bring down their heart (Ps. 107:12), to humble them for sin, to make them low in their own eyes, to cast down every high, proud, aspiring thought. Afflicting providences must be improved as humbling providences; and we not only lose the benefit of them, but thwart God’s designs and walk contrary to him in them if our hearts be unhumbled and unbroken, as high and hard as ever under them. Isa. the estate brought down with labour, the honour sunk? Have those that exalted themselves fallen down, and is there none to help them? Let this bring down the spirit to confess sin, to accept the punishment of it, and humbly to sue for mercy and grace. 4. The duty of this afflicted state, and that is to pray (Ps. 107:13): Then they cried unto the Lord in their trouble, though before perhaps they had neglected him. Prisoners have time to pray, who, when they were at liberty, could not find time; they see they have need of God’s help, though formerly they thought they could do well enough without him. Sense will make men cry when they are in trouble, but grace will direct them to cry unto the Lord, from whom the affliction comes and who alone can remove it. 5. Their deliverance out of the affliction: They cried unto the Lord, and he saved them, Ps. 107:13. He brought them out of darkness into light, welcome light, and then doubly sweet and pleasant, brought them out of the shadow of death to the comforts of life, and their liberty was to them life from the dead, Ps. 107:14. Were they fettered? He broke their bands asunder. Were they imprisoned in strong castles? He broke the gates of brass and the bars of iron wherewith those gates were made fast; he did not put back, but cut in sunder. Note, When God will work deliverance the greatest difficulties that lie in the way shall be made nothing of. Gates of brass and bars of iron, as they cannot keep him out from him people (he was with Joseph in the prison), so they cannot keep them in when the time, the set-time, for their enlargement, comes. 6. The return that is required from those whose bands God has loosed (Ps. 107:15): Let them praise the Lord for his goodness, and take occasion from their own experience of it, and share in it, to bless him for that goodness which the earth is full of, the world and those that dwell therein.