In the
Quran 18:65–82,
Moses meets the Servant of God, referred to in the Quran as "one of our slaves whom We had granted mercy from Us and whom We had taught knowledge from Ourselves".
[30] Muslim scholars identify him as Khiḍr, although he is not explicitly named in the Quran and there is no reference to him being immortal or being especially associated with esoteric knowledge or fertility.
[31] These associations come in later scholarship on al-Khiḍr.
[32]
The Quran states that they meet at the junction of two seas, where a fish that Moses and his servant had intended to eat has escaped. Moses asks for permission to accompany the Servant of God so Moses can learn "right knowledge of what [he has] been taught".
[33] The Servant informs him that "surely you [Moses] cannot have patience with me. And how canst thou have patience about things about which thy understanding is not complete?"
[34] Moses promises to be patient and obey him unquestioningly, and they set out together. After they board a ship, the Servant of God damages the vessel. Forgetting his oath, Moses says, "Have you made a hole in it to drown its inmates? Certainly you have done a grievous thing." The Servant reminds Moses of his warning, "Did I not say that you will not be able to have patience with me?" and Moses pleads not to be rebuked.
Next, the Servant of God kills a young man. Moses again cries out in astonishment and dismay, and again the Servant reminds Moses of his warning, and Moses promises that he will not violate his oath again, and that if he does he will excuse himself from the Servant's presence. They then proceed to a town where they are denied hospitality. This time, instead of harming anyone or anything, the Servant of God restores a decrepit wall in the village. Yet again Moses is amazed and violates his oath for the third and last time, asking why the Servant did not at least exact "some recompense for it."
The Servant of God replies, "This shall be separation between me and you; now I will inform you of the significance of that with which you could not have patience. Many acts which seem to be
evil, malicious or somber, actually are merciful. The boat was damaged to prevent its owners from falling into the hands of a king who seized every boat by force. And as for the boy, his parents were believers and we feared lest he should make disobedience and ingratitude to come upon them. God will replace the child with one better in purity, affection and obedience. As for the restored wall, the Servant explained that underneath the wall was a treasure belonging to two helpless orphans whose father was a righteous man. As God's envoy, the Servant restored the wall, showing God's kindness by rewarding the piety of the orphans' father, and so that when the wall becomes weak again and collapses, the orphans will be older and stronger and will take the treasure that belongs to them."