Answer: In these verses Allah, exalted be His majesty, relates a specific legal case. David (peace be upon him) delivered therein a judgment in accordance with Allah’s law, while Solomon (peace be upon him) delivered a different judgment.
The case was that a flock of sheep strayed at night into another people’s farmland—“nafashat fīhi,” meaning they damaged it and consumed its produce. The owners of the cultivated land came to David (peace be upon him) seeking a verdict against the owners of the sheep. David ruled that the sheep should be handed over to the farmers as compensation for the loss of their crop.
When Solomon heard that ruling, he gave another verdict: the owners of the sheep were to irrigate and tend the field until it returned to its former state, while the sheep would remain with the farmers, who could benefit from them and drink their milk in lieu of the crop they had lost. Once the field was fully restored, it would be returned to its owners and the sheep would be returned to their owners.
Allah, majestic and exalted, cited this story and the two rulings, saying, “And [mention] David and Solomon, when they judged concerning the field when the sheep of a certain people strayed therein by night, and We were witnesses to their judgment. Then We enabled Solomon to understand it” ⦗21:78-79⦘, and He praised both prophets with His words, “And to each of them We gave judgment and knowledge.”
Some scholars say David ruled by revelation and Solomon ruled by revelation as well, so Solomon’s ruling abrogated David’s. Others say both prophets ruled by ijtihad (independent legal reasoning), which serves as evidence that prophets are capable of ijtihad.
In any case, this is part of the judicial wisdom of the two prophets, peace be upon them both, and Allah, exalted be He, has narrated it to His servants as a lesson and a reminder.
***
Exegesis of Sura al-Nur
Question: Allah the Exalted says in His Noble Book, “Corrupt women are for corrupt men, and corrupt men for corrupt women; and good women are for good men, and good men for good women” ⦗al-Nur 24:26⦘. Does