“O John, hold firmly to the Scripture.” And We gave him sound judgment while he was still a child, along with mercy from Us and purity; and he was devout. (12–13)
The words of Allah, exalted is He: “Then he came out to his people from the sanctuary.” The people were behind the sanctuary, waiting for him to open the door for them so that they could enter and pray. When Zachariah came out to them with his complexion changed, they found this strange and said, “What is the matter with you, Zachariah?” “Then he signaled to them”: that is, he gestured to them. Mujahid said: He wrote to them on the ground. “Glorify Allah”: that is, pray to Allah (1), “morning and evening.” Its meaning is that he would come out to his people morning and evening and instruct them to pray. Then, when the time came for his wife to conceive and he was prevented from speaking, he came out to them and instructed them by gesture to pray. (2)
The words of Allah, exalted is He: “O John.” It was said that there is an ellipsis here, the meaning being: “And We bestowed John upon him, and We said to him: ‘O John, hold firmly to the Scripture,’” meaning the Torah, “with determination,” that is, with earnestness. “And We gave him sound judgment.” Ibn Abbas said: “Prophethood,” “while he was still a child”; he was three years old.
It was also said that by “sound judgment” He meant understanding of the Scripture (3); thus, he read the Torah while still young.
It is related from some of the righteous predecessors: Whoever reads the Quran before reaching puberty is among those who were given sound judgment while still children. (4) “And mercy from Us”: mercy from Our presence. Al-Hutay'ah said to Umar ibn al-Khattab, may Allah be pleased with him:
“Show me compassion—may the Sovereign guide you—
For every occasion has words suited to it.” (5)