[15] The office was established by the Constitution of Iran in 1979, pursuant to Ayatollah Ruhollah Khomeini's concept of the Guardianship of the Islamic Jurist,[16] and is a lifetime appointment.
[17] Originally the constitution required the Supreme Leader to be Marja'-e taqlid, the highest-ranking cleric in the religious laws of Usuli Twelver Shia Islam.
[18][19] As the Guardian Jurist (Vali-ye faqih), the Supreme Leader guides the country, protecting it from heresy and imperialist predations, and ensuring the laws of Islam are followed.
[22] The Supreme Leader is the commander-in-chief of the armed forces and the provisional[citation needed] head of the three branches of the state (the Judiciary, the Legislature, and the Executive).
According to Francis Fukuyama, the 1979 constitution is a "hybrid" of "theocratic and democratic elements" with much of it based on the ideas Khomeini presented in his published book Islamic Government (Hukumat-e Islami).
Article 5 states during the absence of the removed Twelfth Imam (may God hasten his reappearance) government and leadership of the community in the Islamic Republic of Iran belong to the rightful God fearing legal scholar (Faqih) who is recognized and acknowledged as the Islamic leader by the majority of the population.Article 107 in the constitution mentions Khomeini by name and praises him as the most learned and talented leader for emulation (marja-i taqlid).
As the rest of the clergy governed affairs on a daily basis, the Supreme Leader is capable of mandating a new decision as per the concept of Vilayat-e Faqih.
Khomeini had a falling out with his successor Hussein-Ali Montazeri who disapproved of human rights abuses by the Islamic Republic[41] such as the mass execution of political prisoners in late summer and early autumn 1988.
[42] "Khomeini is supposed to have written a letter to the Chairman of the assembly of Leadership Experts on 29.4.89 in which he emphasised that he had always been of the opinion that the marja'iyat was not a requirement for the office of leader.
[44] Prior to the revolution, observant Shia Muslims selected their own leading faqih to emulate (known as a Marja'-i taqlid) according to their own decision making.
[38]According to author Seyyed Vali Nasr, Khomeini appealed to the masses, during the pre-1979 period, by referring to them as the oppressed and with charisma and political ability was tremendously successful.