Overall meaning :
Has the story of the two litigants who climbed over the wall into David’s prayer chamber reached you, Muhammad? When they suddenly entered upon David and saw that he was alarmed, they said, ‘Do not be afraid. We are two litigants, one of whom has acted unjustly towards the other. Judge rightly between us and do not be unfair, and show us the way to justice.’
One of them said to David, ‘This brother of mine has ninety-nine ewes, but I have only one. He said, “Let me have charge of it,” and got the better of me with his words!’ David said, ‘He has certainly wronged you by seeking to add your ewe to his many ewes. Truly many partners are unjust to one another and covet the wealth of one another, except for those who believe and do good deeds, but they are few indeed.’
David realised, after giving such judgement, that We were only testing him, so he asked his Lord for forgiveness, fell down in prostration and turned to Us in repentance. We forgave him that sin. In the life to come he will indeed have a status of closeness to Us and an excellent place of destination.
We instructed him thus: David, We have made you an authority in the land. Judge, therefore, between people with justice and do not follow your personal desires, lest they cause you to stray from the truth and deviate from Allah’s way and law. Those who wander astray from Allah’s way will suffer a grievous punishment for having forgotten the Day of Judgement.