And hath the story of the litigants come unto thee? How they climbed the wall into the royal chamber;
How they burst in upon David, and he was afraid of them! They said: Be not afraid! (We are) two litigants, one of whom hath wronged the other, therefor judge aright between us; be not unjust; and show us the fair way.
Lo! this my brother hath ninety and nine ewes while I had one ewe; and he said: Entrust it to me, and he conquered me in speech.
(David) said: He hath wronged thee in demanding thine ewe in addition to his ewes, and lo! many partners oppress one another, save such as believe and do good works, and they are few. And David guessed that We had tried him, and he sought forgiveness of his Lord, and he bowed himself and fell down prostrate and repented.
So We forgave him that; and lo! he had access to Our presence and a happy journey's end.
(And it was said unto him): O David! Lo! We have set thee as a viceroy in the earth; therefor judge aright between mankind, and follow not desire that it beguile thee from the way of Allah. Lo! those who wander from the way of Allah have an awful doom, forasmuch as they forgot the Day of Reckoning.
38:21 - 26, Al Qur'an, Surah Soad (the arabic alphabet), translation by Pickthall.