For many times, Imam Musa Al-Kazem (AS) explicitly introduced his eldest son "Ali" as his immediate successor to the position of Imamate. Subsequent to the martyrdom of his father in Baghdad, on the 25th of Rajab 183 AH falling on September 1, 799 AD in the prison of Abbasid caliph, Harun al-Rashid, he attained the holy position of Imamate, when he was thirty five years old. He held that divine position for twenty years. Three Abbasid caliphs were his contemporaries: for the first ten years Harun al- Rashid, for next five years Amin and finally for the last five years Ma'mun.
After the death of Harun in 809 AD, Ma'mun fell into conflict with his brother Amin, which led to bloody wars and finally the assassination of Amin in 813 AD, after which Ma'mun became caliph. The Umayyad and the Abbasid caliphs were afraid of the Holy Imams (AS), who were publicly recognized as the true and worthy successors of the Messenger of Allah. The Holy Imams (AS), were therefore constantly persecuted and tortured by the ruling caliphs of the time. Ma'mun thought of finding a new solution for these difficulties which his Abbasid predecessors had not been able to solve. Ma'mun contrived to invite Imam Reza (AS) to Merv, (the city where Ma'mun's seat of caliphate was located) with the evil intention of making false friendship with His Holiness. Thus, the cruel Caliph intended to have a direct eye on the Imam. In order to have this decision put into effect, Ma'mun forcefully exiled Imam Reza (AS) from Medina to Merv. On his departure from Medina, Imam Reza (AS) gathered the members of his family and enjoined them to shed tears for his last journey with no return. The Imam did not take any member of his household with him to Merv. His Holiness intended to make the people aware of the exile that Ma'mun had intended for him.
According to Ma'mun’s commands, the direction of Imam Reza’s (AS) caravan from Medina to Merv was predetermined. He arrived in Merv on the 10th of Shawwal in 201 AH / 1 May 817 AD, via Basrah, Khorramshahr, Ahwaz, Rey, Neyshabur, Sanabad and Sarakhs.
Throughout his long journey, the Imam was cordially received by the people living in those cities and villages on the route. When His Holiness arrived in Neyshabur, he narrated a Hadith before an estimated crowd of 120,000 which also included thousands of distinguished scholars and traditionists. This historical and the most famous Hadith is known as "Silsilat al-Dhahab". Imam Reza (AS) confirmed that worshipping God will be counted as a perfect procedure when it is based on the obedience of the Immaculate Holy Imams (AS). This historical statement of Imam Reza (AS) implied the presentation and assertion of the Imamate.
His Holiness was welcomed at Merv by the caliph himself and by Fazl ibn Sahl and some distinguished Abbasid nobles in a place a few leagues outside the capital city. After some days, Ma'mun offered Imam Reza (AS) the caliphate but His Holiness seriously rejected Ma'mun's proposal. Then Ma'mun proposed Imam to accept the successorship to caliphate, the Holy Imam (AS) turned down this proposal as well but he was finally forced to accept the successorship to caliphate. The Imam put forward certain conditions that he would not interfere in governmental affairs or in the appointment or dismissal of government agents.
Ma'mun often managed sessions of debates to be held in his own royal palace and celebrated scholars of various religions were invited there to exchange and discuss their different views on religious issues, Imam Reza (AS) was always victorious in all those debates and soon his opponents recognized the scientific status of His Holiness. Imam Reza (AS) directed Muslims to the right path and removed deviated views of the antagonists who endeavored to distort Islam. In this way the Imam safeguarded and publicized the principles of Islam.
The vicious caliph was scared of the Imam’s ever-increasing popularity. Thus he decided to eliminate him. In 203 AH / 818 AD, Ma'mun first imprisoned Imam Reza (AS) in Sarakhs. Then, the Imam was taken to Sanabad and confined in the palace of Humaid bin Qahtabah. During the morning of the last day of the month of Safar 203 AH/ 818 AD, Imam Reza (AS) was poisoned by Ma'mun in that palace. The Imam (AS) was seized with intensive pain and languor and in the evening of the same day the holy soul of the innocent Imam departed to the Heaven. The Imam was buried in the solitude of night at the same place of the palace which His Holiness had prophesied during his first visit to Humaid bin Qahtabah's palace at Sanabad in 201 AH / 817 AD. Once a small village called Sanabad, it soon transformed into a great metropolis by the presence of the holy shrine of Imam Reza (AS) called as Mashhad al-Reza (tomb sanctuary of Imam Reza (AS); also briefly called Mashhad which is also one of the most extensively visited pilgrimage centers in the world.