Al-Baqarah - 2:251

فَهَزَمُوهُم بِإِذْنِ اللّهِ وَقَتَلَ دَاوُودُ جَالُوتَ وَآتَاهُ اللّهُ الْمُلْكَ وَالْحِكْمَةَ وَعَلَّمَهُ مِمَّا يَشَاء وَلَوْلاَ دَفْعُ اللّهِ النَّاسَ بَعْضَهُمْ بِبَعْضٍ لَّفَسَدَتِ الأَرْضُ وَلَـكِنَّ اللّهَ ذُو فَضْلٍ عَلَى الْعَالَمِينَ
[2:251]
So they put them to flight by Allah's permission. And Dawood slew Jalut, and Allah gave him kingdom and wisdom, and taught him of what He pleased. And were it not for Allah's repelling some men with others, the earth would certainly be in a state of disorder; but Allah is Gracious to the creatures.
By Allah's will they routed them; and David slew Goliath; and Allah gave him power and wisdom and taught him whatever (else) He willed. And did not Allah Check one set of people by means of another, the earth would indeed be full of mischief: But Allah is full of bounty to all the worlds.
So they routed them by Allah's leave and David slew Goliath; and Allah gave him the kingdom and wisdom, and taught him of that which He willeth. And if Allah had not repelled some men by others the earth would have been corrupted. But Allah is a Lord of Kindness to (His) creatures.