al-Mu’tasim, the Abbasid caliph, after he had assassinated Imam Muhammad al-Jawad (a.s.), charged Umar bin al-Faraj to go to Yathrib (Medina) in order to choose a teacher for Imam al-Hadi (a.s.) who was six years and some months then. He asked him to choose a teacher that must be one of the enemies of the Ahlul Bayt (a.s.) so that he would feed him with hatred towards the Ahlul Bayt (a.s.). When Umar arrived in Yathrib, he met the wali there and informed him of his task. The wali and some others directed him to al-Junaydi who had intense grudge towards the Alawids. Umar sent for al-Junaydi who accepted the task. A monthly salary was assigned to al-Junaydi and he was charged to prevent the Shia from visiting or contacting with Imam al-Hadi (a.s.). Al-Junaydi began teaching Imam al-Hadi (a.s.) but he was astonished at the sharp wit and acute intelligence of him. One day, Muhammad bin Ja’far met al-Junaydi and asked him,
‘What about this boy (Imam al-Hadi) whom you teach?’
Al-Junaydi said to him angrily, ‘Do you say “this boy” and not “this sheikh”? I ask you by Allah; do you know anyone in Medina more aware in knowledge and literature than me?’
Muhammad bin Ja’far said, ‘No!’
Al-Junaydi said, ‘I mention some matters of literature and think that I have elaborated upon them, but he (Imam al-Hadi) opens sections of literature where I myself learn from him. People think that I teach him, but, by Allah, I learn from him…’
After some time Muhammad bin Ja’far met al-Junaydi again and asked him, ‘What about the boy?’
Al-Junaydi said to him, ‘Let you not say so! By Allah, he is the best of the inhabitants of the earth and the best of the creatures of Allah. Many a time, when he wants to enter his room, I say to him, ‘You do not enter the room until you recite a sura.’ He says, ‘Which sura you want me to recite?’ I ask him to recite long suras and he recites them in a way that I have heard no recitation better than his. He recites the suras with a voice nicer than the pipes of Prophet David (a.s.). He has memorized the Qur’an from its beginning until its end and he knows its revelation and interpretation…’ Al-Junaydi added, ‘This young boy grew up in Medina between black walls. How did he get this wide knowledge? Glory be to Allah!’
Al-Junaydi gave up his enmity towards the Ahlul Bayt (a.s.) and believed in them and in their imamate.’ ( Ma’athir al-Kubara’ fee Tareekh Samarra’, vol.3 p.95-96. )