Quran 21:78 — The Prophets (Al-Anbya')
And David and Solomon, when they once ruled with regard to someone's crop that was destroyed by another's sheep, we witnessed their judgment.
[21:77] We supported him against the people who rejected our revelations. They were evil people, so we drowned them all.
[21:79] We granted Solomon the correct understanding, though we endowed both of them with wisdom and knowledge. We committed the mountains to serve David in glorifying (God), as well as the birds. This is what we did.