they defeated their enemy through gods will. david slew goliath and god granted david the kingdom and wisdom and also taught him whatever he wanted. had god not made one group of people repel the other the earth would have become full of corruption but god is generous to his creatures.
فهزموهم بإذن الله وقتل داوود جالوت وآتاه الله الملك والحكمة وعلمه مما يشاء ولولا دفع الله الناس بعضهم ببعض لفسدت الأرض ولكن الله ذو فضل على العالمين