[David] said, "He has certainly wronged you in demanding your ewe [in addition] to his ewes. And indeed, many associates oppress one another, except for those who believe and do righteous deeds - and few are they." And David became certain that We had tried him, and he asked forgiveness of his Lord1 and fell down bowing [in prostration] and turned in repentance [to Allāh].
Translation: Saheeh International (English)
1 For his errors, such as fear and suspicion of the two men at the outset, any mistake in judgement he might have made, concealed feelings of partiality, etc.
فَٱسۡتَغۡفَرَand he asked forgivenessfa-is'taghfara
رَبَّهُۥ(of) his Lordrabbahu
وَخَرَّۤand fell downwakharra
رَاكِعٗاۤbowingrākiʿan
وَأَنَابَ۩and turned in repentancewa-anāba
Tafsir
Then David judged between them and addressed the claimant, saying: “Your brother has wronged you when he asked you to add your ewe to his ewes. And many partners oppress one another by taking their rights and not being fair, except the believers who do good actions, for they are fair with their partners and do not wrong them. But those attributed with that are few”. And David (peace be upon him) was convinced that I only put him to test through this dispute, so he sought forgiveness from his Lord and prostrated to get close to Him, and repented to Him.