“And David and Solomon—when they gave judgment concerning the field, when the sheep of some people strayed into it by night—and We were Witnesses to their judgment. We caused Solomon to grasp its true ruling, while to each of them We granted wisdom and knowledge.” (al-Anbiyāʾ 21:78–79)
Shurayḥ the judge, along with a number of the early scholars, relates that the field was in fact a vineyard. A flock belonging to other people wandered into it at night and grazed until they had stripped the vines bare. The two parties brought their case before David, peace be upon him, who ruled that the owners of the vineyard be compensated for its full value. When they came out, they met Solomon and he asked, “How did the Prophet of Allah judge in your case?” They told him, and he said, “Had the matter been left to me, I would only have ruled that the sheep be handed over to the owners of the vineyard so they might benefit from their offspring and milk until the owners of the sheep restore the vineyard to its original condition. When they have done so, they may take back their flock.” When this reached David, peace be upon him, he ruled accordingly.
A similar account is authentically recorded in the two Ṣaḥīḥs from Abū al-Zinād, from al-Aʿraj, from Abū Hurayrah, who said: The Messenger of Allah ﷺ said:
“Two women were walking with their two sons when a wolf came and carried off the child of one of them. They argued over the remaining child. The elder said, ‘The wolf only took your son,’ while the younger insisted, ‘No, it took yours.’ They presented their case to David, who adjudged in favor of the elder. When they later passed by Solomon, he said, ‘Bring me a knife so that I may cut him in two, giving each of you half.’ The younger cried, ‘Do not do that—may Allah have mercy on you! He is her son.’ Solomon therefore awarded the child to her.”
It is probable that both rulings were valid under their law, yet Solomon’s decision was the sounder. Hence Allah praised him for the discernment He inspired in him, and thereafter commended his father as well, saying:
“To each We granted judgment and knowledge; and We subjected the mountains and the birds to join David in glorifying Us—we alone accomplished this. And We taught him the craft of fashioning coats of mail for you to fortify you in battle—so will you then give thanks?” (al-Anbiyāʾ 21:79-80)
Then He said: “And for Solomon We made the wind, tempestuous…”—that is, We subjected it to him—