The Lord shall judge the people
The inhabitants of the world in general; for God is the Judge of all the earth, and he judges the world in righteousness daily, and ministers judgment in uprightness, though it is not always manifest; or his own people in particular, whose cause he pleads, whose injuries and wrongs he avenges, whose persons he protects and defends; this the psalmist expresses with confidence, and therefore, suitable to his character as a Judge, he entreats him as follows:
judge me, O Lord, according to my righteousness;
he speaks not of his justification before God, in whose sight he well knew no flesh living could be justified by their own righteousness, ( Psalms 143:2 ) ; nor of the righteousness of his person, either imputed or inherent; but of the righteousness of his cause, ( Psalms 35:27 ) ; not of his righteousness God-ward, for he knew that he was a sinner with respect to him; but of his righteousness towards Saul, against whom he had not sinned, but had acted towards him in the most righteous and faithful manner, ( 1 Samuel 24:11 ) ; and therefore desired to be judged, and was content to stand or fall according to his conduct and behaviour towards him;
and according to mine integrity [that is] in me;
who had always acted the sincere and upright part towards Saul, though he had pursued him with so much fury and violence; the psalmist's prayer was heard and answered, ( Psalms 18:20 Psalms 18:24 ) .