Bahá'í history is often traced through a sequence of leaders, beginning with the Báb's declaration in Shiraz on the evening of May 22, 1844, and ultimately resting on an Administrative Order established by the central figures of the religion. The religion had its background in two earlier movements in the nineteenth century, Shaykhism and Bábism. Shaykhism centred on theosophical doctrines and many Shaykhis expected the return of the hidden Twelfth Imam. Many Shaykhis joined the messianic Bábí movement in the 1840s where the Báb proclaimed himself to be the return of the hidden Imam. As the Bábí movement spread in Iran, violence broke out between the ruling Shi'a Muslim government and the Bábís, and ebbed when government troops massacred them, and executed the Báb in 1850.
The Báb had spoken of another messianic figure, He whom God shall make manifest. As one of the followers of the Báb, Bahá'u'lláh was imprisoned during a subsequent wave of massacre by the Persian government against Bábís in 1852, was exiled to Iraq, and then to Constantinople and Adrianople in the Ottoman Empire. Amidst these banishments, in 1863 in Baghdad, Bahá'u'lláh claimed to be the messianic figure expected by the Báb's writings. Bahá'ís consider the Baha'i religion to start from Bahá'u'lláh's statements in 1863.
At the time of Bahá'u'lláh's death the tradition was mostly confined to the Persian and Ottoman empires, at which time he had followers in thirteen countries of Asia and Africa. Leadership of the religion then passed on to `Abdu'l-Bahá, Bahá'u'lláh's son, who was appointed by Bahá'u'lláh, and was accepted by almost all Bahá'ís. Under the leadership of `Abdu'l-Bahá, the religion gained a footing in Europe and America, and was consolidated in Iran, where it still suffers intense persecution.
After the death of `Abdu'l-Bahá in 1921, the leadership of the Bahá'í community was passed on to his grandson, Shoghi Effendi, who was appointed in `Abdu'l-Bahá's will. The document appointed Shoghi Effendi as the first Guardian, and called for the election of the Universal House of Justice once the Bahá'í Faith had spread sufficiently for such elections to be meaningful. During Shoghi Effendi's time as leader of the religion there was a great increase in the number of Baha'is, and he presided over the election of many National Spiritual Assemblies.
Shoghi Effendi died in 1957, and because he was childless he had found it impossible to appoint another Guardian after himself to succeed him. In 1963 the Universal House of Justice was elected. Since 1963 the Universal House of Justice has been elected every five years and remains the successor and leading institution of the religion. See Bahá'í Faith by country for further information per country.
In Islam, the Mahdi is a messianic figure who is believed to be a descendant of Muhammad who will return near the end of time to restore the world and the religion of God. While both Sunni and Shi'a groups believe in the Mahdi, the largest Shi'a group, the Twelvers, believe that the Mahdi is the Twelfth Imam, Muhammad al-Mahdi, who is believed to have gone into occultation since 874 CE.
In the Twelver view the Twelfth Imam first went into a "Minor Occultation" between 874 and 941 CE where the Hidden Imam still communicated with the community through four official intermediaries. The "Greater Occultation" is then defined from the time when the Hidden Imam ceased to communicate regularly until the time when he returns to restore the world.
The Shaykhi movement was a school of theology within Twelver Shi'a Islam that was started through the teaching of Shaykh Ahmad al-Ahsá'í. Shaykh Ahmad's teachings included that the Imams were spiritual beings and thus, in contrast to the widespread Shi'a belief, that the Imams existed within spiritual bodies, and not material bodies. He also taught that there must always exist the "Perfect Shi'a" who serves as an intermediary between the Imams and the believers, and is the one who can visualize the consciousness of the Hidden Imam.
In 1822 he left Iran and went to Iraq due to the controversy that his teachings had brought. There he also found himself at the centre of debate, thus deciding to move to Mecca, he died in 1826 on his way there.
Before the death of Shaykh Ahmad, he appointed Siyyid Kázim of Rasht to lead the Shaykhí movement, which he did until his death in 1843. Siyyid Kázim formulated many of the thoughts that were ambiguously expressed by Shaykh Ahmad including the doctrine of salvation history and the cycles of revelation. His teaching brought a sense of millenarian hope among the Shaykhis that the Hidden Imam may return. Siyyid Kazim did not leave a successor, but before his death in December, 1843, he had counselled his followers to leave their homes to seek the Mahdi, who according to his prophecies would soon appear.
Siyyid `Alí-Muhammad, who later took on the title the Báb, was born on October 20, 1819, in Shiraz to a merchant of the city; his father died while he was quite young and the boy was raised by his maternal uncle ?ájí Mírzá Siyyid `Alí, who was also a merchant.
In May 1844 the Báb proclaimed to Mulla Husayn, one of the Shaykhis, to be the one whose coming was prophesized by Shaykh Ahmad and Siyyid Kázim and the bearer of divine knowledge. Within five months, seventeen other disciples of Siyyid Ká?im had recognized the Báb as a Manifestation of God. These eighteen disciples were later to be known as the Letters of the Living and were given the task of spreading the new faith across Iran and Iraq. The Báb initially attracted most of the followers of the Shaykhí movement, but soon his teachings went far beyond those roots and attracted prominent followers across Iran. His followers were known as Bábís.
The first accounts in the West of events related to the history of the Báb and his followers appears January 8, 1845 as an exchange of diplomatic reports not published in the newspapers. This was an account of the first Letter of the Living to be dispatched from the presence of the Báb - the second Letter of the Living and first Babi martyr, Mullá `Alí-i-Bastámí. The British diplomat who recorded these events was Sir Henry Rawlinson, 1st Baronet who wrote first to Stratford Canning, 1st Viscount Stratford de Redcliffe, then Ambassador to Istanbul, and it included an enclosure from the Governor of Kirmánsháh protesting the arrest in Ottoman lands of a Persian mullá. Followup exchanges continued from January into April where diplomatic records of events end. Ottoman state archives affirm his arrival in Istanbul where he is then sentenced to serve in the naval ship yards at hard labor - the Ottoman ruler refusing to banishment him as it would be "difficult to control his activities and prevent him spreading his false ideas." The first public account was published Nov 1, 1845 in the London Times. It was centered on events in Shiraz when the last Letter of the Living, Quddús returned after traveling with the Báb. The story was also carried from Nov 15 by the Literary Gazette which was subsequently echoed widely in other countries.
After some time, preaching by the Letters of the Living led to opposition by the Islamic clergy, prompting the Governor of Shiraz to order the Báb's arrest. After being house arrest in Shiraz from June 1845 to September 1846, the Báb spent several months in Isfahan debating clergy, many who became sympathetic. He was then ordered by the Shah to Tehran in January 1847; after spending several months in a camp outside Tehran, the Prime Minister sent the Báb to Tabriz in the northwestern corner of the country, where he was confined.
He was then transferred to the fortress of Máh-Kú in the province of Azarbaijan close to the Turkish border. During his incarceration there, the Báb began his most important work, the Persian Bayán, which he never finished. He was then transferred to the fortress of Chihríq in April 1848. In that place as well, the Báb's popularity grew and his jailors relaxed restrictions on him. Hence the Prime Minister ordered the Báb back to Tabriz where the government called on religious authorities to put the Báb on trial for blasphemy and apostasy.Bábism was also spreading across the country, and the Islamic government saw it as a threat to state religion and several military confrontations took place between government and Bábí forces. Communities of Bábís established themselves in Iran and Iráq, and in 1850 reached several cities of Azarbaijan. Coverage in newspapers in the West reoccurred in 1849 including in the French journal Revue de l'Orient. In the fall of 1850 newspaper coverage fell behind quickly unfolding events. Though the Báb was named for the first time he had in fact already been executed.
In mid-1850 a new prime-minister, Amir Kabir, ordered the execution of the Báb, probably because various Bábí insurrections had been defeated and the movement's popularity appeared to be waning. The Báb was brought back to Tabríz from Chihríq, so that he could be shot by a firing squad. On the morning of July 9, 1850, the Báb was taken to the courtyard of the barracks in which he was being held, where thousands of people had gathered to watch. The Báb and a companion were suspended on a wall and a large firing squad prepared to shoot. After the order was given to shoot and the smoke cleared, the Báb was no longer in the courtyard and his companion stood there unharmed; the bullets apparently had not harmed either man, but had cut the rope suspending them from the wall. The soldiers subsequently found the Báb in another part of the barracks, completely unharmed. He was tied up for execution a second time, a second firing squad was ranged in front of them, and a second order to fire was given. This time, the Báb and his companion were killed. Their remains were dumped outside the gates of the town to be eaten by animals.
The remains, however, were rescued by a handful of Bábis and were hidden. Over time the remains were secretly transported by way of Isfahan, Kirmansháh, Baghdad and Damascus, to Beirut and thence by sea to Acre, Israel on the plain below Mount Carmel in 1899. In 1909, the remains were then interred in a special tomb, erected for this purpose by `Abdu'l-Bahá, on Mount Carmel in the Bahá'í Holy Land in Haifa, Israel and remains an important place of pilgrimage for Bahá'ís. The Bahá'í Shrine in Haifa, Israel, is a protected site.
While the Báb claimed a station of revelation, he also claimed no finality for his revelation. A constant theme in his works, especially the Persian Bayan was that of the great Promised One, the next embodiment of the Primal Will, whom the Báb termed He whom God shall make manifest, promised in the sacred writings of previous religions would soon establish the Kingdom of God on the Earth. In the books written by the Báb he constantly entreats his believers to follow He whom God shall make manifest when he arrives.
Before his death, the Báb had been in correspondence with two brothers, Bahá'u'lláh and Subh-i-Azal who, after the death of many prominent disciples, emerged as the mostly likely leaders. In a letter sent to Subh-i-Azal, then aged around nineteen, the Báb appears to have indicated a high station or leadership position. The letter also orders Subh-i-Azal to obey the Promised One when he appears; in practise, Subh-i-Azal, however, seems to have had little widespread legitimacy and authority. Bahá'u'lláh in the meantime, while in private hinted at his own high station, in public kept his messianic secret from most and supported Subh-i-Azal in the interest of unity. In 1863 in Baghdad, he made his first public declaration and eventually was recognized by the vast majority of Bábís as "He whom God shall make manifest" and his followers began calling themselves Bahá'ís.
Bahá'u'lláh was born on November 12, 1817, in Tehran. Bahá'u'lláh's father was entitled Mírzá Buzurg while he served as vizier to Imám-Virdi Mírzá, the twelfth son of Fat?h Ali Shah Qajar. Mírzá Buzurg was later appointed governor of Burujird and Lorestan, a position that he was stripped of during a government purge when Muhammad Shah came to power. After his father died, Bahá'u'lláh was asked to take a government post by the new vizier Haji Mirza Aqasi, but he declined the position.
At the age of 28, Bahá'u'lláh received a messenger, Mullá Husayn, telling him of the Báb, whose message he accepted, becoming a Bábí. Bahá'u'lláh began to spread the new cause, especially in his native province of Núr, becoming recognized as one of its most influential believers. The accompanying government suppression of the Báb's religion resulted in Bahá'u'lláh's being imprisoned twice and enduring bastinado torture once Bahá'u'lláh also attended the Conference of Badasht, where 81 prominent Babis met for 22 days; at that conference where there was a discussion between those Babis who wanted to maintain Islamic law and those who believed that the Báb's message began a new dispenation, Bahá'u'lláh took the pro-change side, which eventually won out.
In 1852, two years after the execution of the Báb, the Bábís were polarized with one group speaking of violent retribution against the Shah, Nasser-al-Din Shah while the other, under the leadership of Baha'u'llah, looked to rebuild relationships with the government and advance the Babí cause by persuasion and the example of virtuous living. The militant group of Babis was between thirty and seventy persons, only a small number of the total Babi population of perhaps 100,000. Their meetings appear to have come under the control of a "Husayn Jan", an emotive and magnetic figure who obtained a high degree of personal devotion to himself from the group.
Bahá'u'lláh met briefly with a couple of the radical Babi leaders and learned of an assassination plan. He condemned the plan, but was soon asked to leave Tehran by the authorities. In the vacuum of leadership on August 15, 1852 about 3 Babis attempted the assassination of the Shah and failed. Notwithstanding the assassins' claim that they were working alone, the entire Bábí community was blamed, and a slaughter of several thousand Bábís followed. Amidst the general violence some Bábís were imprisoned in the Síyáh-Chál (Black Pit), an underground dungeon of Tehran. According to Bahá'u'lláh, perhaps the lone survivor, it was during his imprisonment in the Síyáh-Chál that he had several mystical experiences, and that he received a vision of a Maiden from God, through whom he received his mission as a Messenger of God and as the One whose coming the Báb had prophesied.
The government later found Bahá'u'lláh innocent of complicity in the assassination plot, and he was released from the Síyáh-Chál, but the government exiled him from Iran. Bahá'u'lláh chose to go to Iraq in the Ottoman Empire and arrived in Baghdad in early 1853. A small number of Babis, including his half-brother Subh-i-Azal, followed Bahá'u'lláh to Baghdad. An increasing number of Bábís considered Baghdad the new centre for leadership of the Bábí religion, and a flow of pilgrims started coming there from Persia. In Baghdad people began to look to Subh-i-Azal for leadership less and less due to his policy of remaining hidden, and instead saw Bahá'u'lláh as their leader. Subh-i-Azal started to try to discredit Bahá'u'lláh and further divided the community. The actions of Subh-i-Azal drove many people away from the religion and allowed its enemies to continue their persecution.
On April 10, 1854 Bahá'u'lláh left Baghdad in order to distance himself from Subh-i-Azal and as to avoid becoming the source of disagreement within the Babi community; he left with one companion to the mountains of Kurdistan, north-east of Baghdad, near the city Sulaymaniyah. For two years Bahá'u'lláh lived alone in the mountains of Kurdistan living the life of a Sufi dervish. At one point someone noticed his remarkable penmanship, which brought the curiosity of the instructors of the local Sufi orders. During his time in Kurdistan he wrote many notable books including the Four Valleys. In Baghdad, given the lack of firm and public leadership by Subh-i-Azal, the Babi community had fallen into disarray. Some Babis, including Bahá'u'lláh's family, thus searched for Bahá'u'lláh, and pleaded with him to come back to Baghdad, which he did in 1856.
Bahá'u'lláh remained in Baghdád for seven more years. During this time, while keeping his perceived station as the Manifestation of God hidden, he taught the Báb's teachings. He published many books and verses including the Book of Certitude and the Hidden Words. Bahá'u'lláh's gatherings attracted many notables, both locals and Iranian pilgrims, giving him greater influence in Baghdad and in Iran. His rising influence in the city, and the revival of the Persian Bábí community gained the attention of his enemies in Islamic clergy and the Persian government. They were eventually successful in having the Ottoman government call Bahá'u'lláh from Baghdad to Constantinople.
Before he left Baghdad on the way to Constantinople, Bahá'u'lláh camped for twelve days in the Garden of Ridván near Baghdad starting on April 22, 1863. During his stay in the garden a large number of friends came to see him before he left. It was during his time in the Garden of Ridván that Bahá'u'lláh declared to his companions his perceived mission and station as a Messenger of God. Today Bahá'ís celebrate the twelve days that Bahá'u'lláh was in the Garden of Ridván as the festival of Ridván.
After travelling for four-month over land, Bahá'u'lláh arrived in the capital of the Ottoman Empire, Constantinople (now Istanbul). Although not a formal prisoner yet, the forced exile from Baghdad was the beginning of a long process which would gradually move him into further exiles and eventually the penal colony of Akká, Ottomon Empire's Palestine (now Acre, Israel). Bahá'u'lláh and his family, along with a small group of Bábís, stayed in Constantinople for only four months. Due to his refusal to build alliances with the Ottoman politicians, Bahá'u'lláh had no means of resisting pressure from the Iranian ambassador to exile him further away, and Sultan Abdülâziz banished Bahá'u'lláh to Adrianople (current-day Edirne), which was a site for the exile of political prisoners.
During the month of December 1863, Bahá'u'lláh and his family embarked on a twelve-day journey to Adrianople. Bahá'u'lláh stayed in Adrianople for four and a half years. In Adrianople Bahá'u'lláh made his claim to be Him whom God shall make manifest more public through letters and tablets. Bahá'u'lláh's assertion as an independent Manifestation of God made Subh-i-Azal's leadership position irrelevant; Subh-i-Azal, upon hearing Bahá'u'lláh's words in a tablet read to him, challenging him to accept Bahá'u'lláh's revelation, refused and challenged Bahá'u'lláh to a test of divine will at a local mosque, but he lost face when he did not appear. This caused a break within the Bábí community, and the followers of Bahá'u'lláh became known as Bahá'ís, while the followers of Subh-i-Azal became known as Azalis.
Starting in 1866, while in Adrianople, Bahá'u'lláh started writing a series of letters to world rulers, proclaiming his station as the promised one of all religions. His letters also asked them to renounce their material possessions, work together to settle disputes, and endeavour towards the betterment of the world and its peoples. Some of these leaders written to in the coming years include Pope Pius IX, Napoleon III of France, Czar Alexander II of Russia, Queen Victoria of Great Britain and Ireland, Násiri'd-Dín Sháh of the Persian Empire and the rulers of America.
The disagreements between the Bahá'ís and the Azalís allowed the Ottoman and Persian authorities to exile Bahá'u'lláh once again. Bahá'u'lláh and his family left Adrianople on August 12, 1868 and after a journey by land and sea arrived in Acre on August 31. The first years in Acre imposed very harsh conditions on, and held very trying times for, Bahá'u'lláh. Mirzá Mihdí, Bahá'u'lláh's son, was suddenly killed at the age of twenty-two when he fell through a skylight while pacing back and forth in prayer and meditation. After some time, the people and officials began to trust and respect Bahá'u'lláh, and thus the conditions of the imprisonment were eased and eventually, after Sultan `Abdu'l-`Aziz's death, he was allowed to leave the city and visit nearby places.
The final years of Bahá'u'lláh's life were spent in the Mansion of Bahjí, just outside Acre, even though he was still formally a prisoner of the Ottoman Empire. During his years in Acre and Bahjí, Bahá'u'lláh produced many volumes of work including the Kitáb-i-Aqdas. On May 9, 1892 Bahá'u'lláh contracted a slight fever which grew steadily over the following days, abated, and then finally took his life on May 29, 1892. He was buried in a Shrine located next to the Mansion of Bahjí in Israel. During his lifetime, communities of Bahá'ís were established in Armenia, Burma, Egypt, Georgia, India, Lebanon, (what is now) Pakistan, Sudan, Syria, Turkey, and Turkmenistan.
Bahá'u'lláh was succeeded by his eldest son, `Abdu'l-Bahá. Designated as the "Center of the Covenant" and Head of the Faith, Bahá'u'lláh designated him in his will as the sole authoritative interpreter of Bahá'u'lláh's writings. 
`Abdu'l-Bahá had shared his father's long exile and imprisonment. This imprisonment continued until `Abdu'l-Bahá's own release as a result of the "Young Turk" revolution in 1908. The remains of the Báb were buried on March 21, 1909 in a six-room mausoleum made of local stone.
Following his release he led a life of travelling and speaking especially 1910-1913, and maintaining correspondence with communities of believers and individuals, expounding the principles of the Bahá'í Faith. `Abdu'l-Bahá died in Haifa on November 28, 1921 and is now buried in one of the front rooms in the Shrine of the Báb, in Haifa, Israel. During his lifetime communities of Bahá'ís formed in Australia, Austria, Brazil, Canada, China, the United Kingdom, France, Germany, the Netherlands, Hungary, Italy, Japan, Jordan Russia, South Africa, Switzerland, Tunisia, and the United States of America.
`Abdu'l-Bahá's Will and Testament  is the charter of the Bahá'í administrative order. In this document `Abdu'l-Bahá established the institutions of the appointed Guardianship and the elected Universal House of Justice. In that same document he appointed his eldest grandson, Shoghi Effendi, as the first Guardian of the Bahá'í Faith.
Shoghi Effendi throughout his lifetime translated the sacred writings of the Faith; developed global plans for the expansion of the Bahá'í community; developed the Bahá'í World Centre; carried on a voluminous correspondence with communities and individuals around the world; and built the administrative structure of the Faith, preparing the community for the election of the Universal House of Justice.
With the unexpected passing of Shoghi Effendi in 1957, the faith was left without a clear candidate for Guardian. The Hands of the Cause, appointed by Shoghi Effendi, took the necessary administrative roles at the Bahá'í World Centre, and organized the election of the Universal House of Justice, from which they excluded themselves from membership. By the time of the election of the Universal House of Justice, Bahá'í communities had been established in many of the countries of the world. Seventy nations had organized their communities to elect National Spiritual Assemblies.
After the election of the Universal House of Justice in 1963, it then ruled that given the unique situation and the provisions of the Will and Testament of `Abdu'l-Bahá, it was not possible to appoint another Guardian. The Universal House of Justice today remains the supreme governing body of the Bahá'í Faith, and its nine members are elected every five years. As recently as 2001 the number of countries with organized communities electing National Spiritual Assemblies was 182.