Allah states that the angels spoke to Maryam by His command and told her that He chose her because of her service to Him, because of her modesty, honor, innocence, and conviction. Allah also chose her because of her virtue over the women of the world. At-Tirmidhi recorded that `Ali bin Abi Talib said, "I heard the Messenger of Allah say,
(The best woman (in her time) was Maryam, daughter of `Imran, and the best woman (of the Prophet's time) is Khadijah (his wife), daughter of Khuwaylid.)"
The Two Sahihs recorded this Hadith. Ibn Jarir recorded that Abu Musa Al-Ash`ari said that the Messenger of Allah said,
(Many men achieved perfection, but among women, only Maryam the daughter of `Imran and Asiah, the wife of Fir`awn, achieved perfection.)
The Six -- with the exception of Abu Dawud - recorded it. Al-Bukhari's wording for it reads,
(Many men reached the level of perfection, but no woman reached such a level except Asiah, the wife of Fir`awn, and Maryam, the daughter of `Imran. The superiority of `A'ishah (his wife) to other women, is like the superiority of Tharid (meat and bread dish) to other meals.)
We mentioned the various chains of narration and wordings for this Hadith in the story of `Isa, son of Maryam, in our book, Al-Bidayah wan-Nihayah, all the thanks are due to Allah.
Allah states that the angels commanded Maryam to increase acts of worship, humbleness, submission, prostration, bowing, and so forth, so that she would acquire what Allah had decreed for her, as a test for her. Yet, this test also earned her a higher grade in this life and the Hereafter, for Allah demonstrated His might by creating a son inside her without male intervention. Allah said,
("O Maryam! Submit yourself with obedience (Aqnuti) and prostrate yourself, and bow down along with Ar-Raki`in.")
As for Qunut (Aqnuti in the Ayah), it means to submit with humbleness. In another Ayah, Allah said,
(Nay, to Him belongs all that is in the heavens and on earth, and all surrender with obedience (Qanitun) to Him.) 2:116
Allah next said to His Messenger after He mentioned Maryam's story,
(This is a part of the news of the Ghayb which We reveal.) "and narrate to you (O Muhammad ), "
(You were not with them, when they cast lots with their pens as to which of them should be charged with the care of Maryam; nor were you with them when they disputed.) meaning, "You were not present, O Muhammad, when this occurred, so you cannot narrate what happened to the people as an eye witness. Rather, Allah disclosed these facts to you as if you were a witness, when they conducted a lottery to choose the custodian of Maryam, seeking the reward of this good deed."
Ibn Jarir recorded that `Ikrimah said, "Maryam's mother left with Maryam, carrying her in her infant cloth, and took her to the rabbis from the offspring of Aaron, the brother of Musa. They were responsible for taking care of Bayt Al-Maqdis (the Masjid) at that time, just as there were those who took care of the Ka`bah. Maryam's mother said to them, `Take this child whom I vowed to serve the Masjid, I have set her free, since she is my daughter, for no menstruating woman should enter the Masjid, and I shall not take her back home.' They said, `She is the daughter of our Imam,' as `Imran used to lead them in prayer, `who took care of our sacrificial rituals.' Zakariyya said, `Give her to me, for her maternal aunt is my wife.' They said, `Our hearts cannot bear that you take her, for she is the daughter of our Imam.' So they conducted a lottery with the pens with which they wrote the Tawrah, and Zakariyya won the lottery and took Maryam into his care."'. `Ikrimah, As-Suddi, Qatadah, Ar-Rabi` bin Anas, and several others said that the rabbis went into the Jordan river and conducted a lottery there, deciding to throw their pens into the river. The pen that remained afloat and idle would indicate that its owner would take care of Maryam. When they threw their pens into the river, the water took all the pens under, except Zakariyya's pen, which remained afloat in its place. Zakariyya was also their master, chief, scholar, Imam and Prophet, may Allah's peace and blessings be on him and the rest of the Prophets.