قَالَ لَقَدۡ ظَلَمَكَ بِسُؤَالِ نَعۡجَتِكَ إِلَىٰ نِعَاجِهِۦۖ وَإِنَّ كَثِيرٗا مِّنَ ٱلۡخُلَطَآءِ لَيَبۡغِي بَعۡضُهُمۡ عَلَىٰ بَعۡضٍ إِلَّا ٱلَّذِينَ ءَامَنُواْ وَعَمِلُواْ ٱلصَّـٰلِحَٰتِ وَقَلِيلٞ مَّا هُمۡۗ وَظَنَّ دَاوُۥدُ أَنَّمَا فَتَنَّـٰهُ فَٱسۡتَغۡفَرَ رَبَّهُۥ وَخَرَّۤ رَاكِعٗاۤ وَأَنَابَ۩
He (Dawud) said, "Indeed he has already done an injustice to you in asking for your ewe (in addition) to his ewes; and surely many intermixes are indeed inequitable one against the other, (Literally: some of them are unfair to some "others") except the ones who have believed and done deeds of righteousness, and how few they are!" And Dawud surmised that We had only tempted (Or: tried) him; so he asked forgiveness of his Lord, and he collapsed bowing down and turned penitent. A prostration is to be performed here.
فَغَفَرۡنَا لَهُۥ ذَٰلِكَۖ وَإِنَّ لَهُۥ عِندَنَا لَزُلۡفَىٰ وَحُسۡنَ مَـَٔابٖ
So We forgave him that, and surely he has in Our Providence proximity indeed and a fair resorting.
يَٰدَاوُۥدُ إِنَّا جَعَلۡنَٰكَ خَلِيفَةٗ فِي ٱلۡأَرۡضِ فَٱحۡكُم بَيۡنَ ٱلنَّاسِ بِٱلۡحَقِّ وَلَا تَتَّبِعِ ٱلۡهَوَىٰ فَيُضِلَّكَ عَن سَبِيلِ ٱللَّهِۚ إِنَّ ٱلَّذِينَ يَضِلُّونَ عَن سَبِيلِ ٱللَّهِ لَهُمۡ عَذَابٞ شَدِيدُۢ بِمَا نَسُواْ يَوۡمَ ٱلۡحِسَابِ
O Dawud, surely We have made you a succeeding (Literally: Caliph) (Messenger) in the earth, so judge among mankind with the truth, and do not ever follow prejudice that it may make you err from the way of Allah. Surely the ones who err from the way of Allah will have a strict torment for that they have forgotten the Day of Reckoning.