Hizb 31 opens with Khidr finally explaining his three puzzling actions to Moses once Moses can no longer hold his questions back: the boat was damaged deliberately to keep a tyrant from seizing a working vessel, the youth was taken before he could grow into a source of grief for his righteous parents, and the wall was rebuilt without payment to protect a hidden treasure for two orphans until they come of age, each act concealing a mercy Moses could not have seen in advance.
The sura then completes the story of Dhul-Qarnayn, a righteous traveling ruler who journeys to a western place of murky water, to an eastern people with no shelter from the sun, and finally builds a barrier of iron and molten copper to protect a people from Gog and Magog, a barrier the text says will eventually be breached as a sign of the approaching Hour. Al-Kahf closes with the image of the sea itself running out as ink before God's words could be exhausted.
The hizb then carries the whole of Maryam: Zechariah's prayer answered with a son in his old age, the annunciation of Jesus to Mary and his birth, the infant Jesus speaking from the cradle to defend his mother's honor, and Abraham's gentle argument with his own idol worshipping father, closing on a warning against the claim that God has taken a son.