The prayer continues after Psalm 17:8 Keep me as the apple…
In Psalm 17:13 the author prays that the Lord will act—step by step—by first arising (e.g., from sleep), then approaching the enemy. He must be dealt with and then be knocked to the ground. The author says, handle him in such a way that he will fall and be defeated. The judge must also act as a mighty king. Justice must truly prevail.
In Psalm 3:7 and Psalm 5:11 we read of very similar things. The judge/king listens to the one who prays—the weak, the underdog—and he is carrying out his justice and so protects the weak. The judgment, mentioned in Psalm 17:2, is being implemented.
This verse says: the wicked… are men of the world whose portion is in this life. This is how the wicked are being portrayed: their existence is determined by their lives here and now. See what punishment the Lord brings upon them: You fill their womb with treasure; they are satisfied with children, and they leave their abundance to their infants.
This is a very special punishment: The Lord fill their womb with treasures; they have many children, and that is also their prosperity.
Another explanation of these words are that the people with their children are inundated with prosperity, and that they are completely absorbed in it; see the words whose portion is this life.
With that, the judgment is clear: only this earthly life in the here and now is what matters to them and their children. There is no further perspective here.
In this regard, read Psalm 4:7: You have put more joy in my heart than they have when their grain and wine abound.
Here the joy in the Lord from the heart stands over against an abundance of food and drink. Those who only live for the here and now, who idolizes prosperity, will also perish in their prosperity. They do not live in thankfulness to God, the Giver of everything, but in short-sighted egotism.
The author seems to have a horrible fate, namely, to go under in enmity. But according to the last verse, that is not what happens.
13 Arise, O LORD! Confront him, subdue him! Deliver my soul from the wicked by your sword,