The prophet Zoroaster (Zarathustra), who was born in the seventh century B.C. in what is now Azerbaijan, established a religion focused on the cosmic struggle between a supreme god and an evil spirit. Islam arrived in Azerbaijan with Arab invaders in the seventh century A.D., gradually supplanting Zoroastrianism and Azerbaijani pagan cults. In the seventh and eighth centuries, many Zoroastrians fled Muslim persecution and moved to India, where they became known as Parsis. Until Soviet Bolsheviks ended the practice, Zoroastrian pilgrims from India and Iran traveled to Azerbaijan to worship at sacred sites, including the Surakhany Temple on the Apsheron Peninsula near Baku.
In the sixteenth century, the first shah of the Safavid Dynasty, Ismail I (r. 1486-1524), established Shia Islam as the state religion, although large numbers of Azerbaijanis remained followers of the other branch of Islam, Sunni. The Safavid court was subject to both Turkic (Sunni) and Iranian (Shia) influences, however, which reinforced the dual nature of Azerbaijani religion and culture in that period. As elsewhere in the Muslim world, the two branches of Islam came into conflict in Azerbaijan. Enforcement of Shia Islam as the state religion brought contention between the Safavid rulers of Azerbaijan and the ruling Sunnis of the neighboring Ottoman Empire.
In the nineteenth century, many Sunni Muslims emigrated from Russian-controlled Azerbaijan because of Russia's series of wars with their coreligionists in the Ottoman Empire. Thus, by the late nineteenth century, the Shia population was in the majority in Russian Azerbaijan. Antagonism between the Sunnis and the Shia diminished in the late nineteenth century as Azerbaijani nationalism began to emphasize a common Turkic heritage and opposition to Iranian religious influences. At present, about three-quarters of Azerbaijani Muslims are at least nominally Shia (and 87 percent of the population was Muslim in 1989).
Azerbaijan's next largest official religion is Christianity, represented mainly by Russian Orthodox and Armenian Apostolic groups. Some rural Azerbaijanis retain pre-Islamic shamanist or animist beliefs, such as the sanctity of certain sites and the veneration of certain trees and rocks.
Before Soviet power was established, about 2,000 mosques were active in Azerbaijan. Most mosques were closed in the 1930s, then some were allowed to reopen during World War II. In the 1980s, however, only two large and five smaller mosques held services in Baku, and only eleven others were operating in the rest of the country. Supplementing the officially sanctioned mosques were thousands of private houses of prayer and many secret Islamic sects. Beginning in the late Gorbachev period, and especially after independence, the number of mosques rose dramatically. Many were built with the support of other Islamic countries, such as Iran, Oman, and Saudi Arabia, which also contributed Qurans (Korans) and religious instructors to the new Muslim states. A Muslim seminary has also been established since 1991. As in the other former Soviet Muslim republics, religious observances in Azerbaijan do not follow all the traditional precepts of Islam. For example, drinking wine is permitted, and women are not veiled or segregated.
During World War II, Soviet authorities established the Muslim Spiritual Board of Transcaucasia in Baku as the governing body of Islam in the Caucasus, in effect reviving the nineteenthcentury tsarist Muslim Ecclesiastical Board. During the tenures of Leonid I. Brezhnev and Mikhail S. Gorbachev, Moscow encouraged Muslim religious leaders in Azerbaijan to visit and host foreign Muslim leaders, with the goal of advertising the freedom of religion and superior living conditions reportedly enjoyed by Muslims under Soviet communism. In the early 1980s, Allahshukur Humatoglu Pashazade was appointed Sheikh ul-Islam, head of the Muslim board. With the breakup of the Soviet Union, the Muslim board became known as the Supreme Religious Council of the Caucasus Peoples. In late 1993, the Sheikh blessed Heydar Aliyev at his swearing-in ceremony as President of Azerbaijan.
Azerbaijan is the only country other than Iran whose official religion is Shiite Islam. However, the Azeri attitude to religion is fairly laid back, and the atmosphere is a million miles away from the fundamentalism of Iran's Islamic Revolution. Nominal religious affiliations are roughly 66% Shiite Muslim, 28% Sunni Muslim. 4.2% Orthodox Christian, 1.8% other, but a large proportion of the population is non-practising. The so-called Mountain Jews of Quba form a significant religious minority group.
Despite the predominance of Islam, there is a strong undercurrent of ancient Zoroastrian and animist beliefs. In the countryside there are many pirs (sacred places), be they trees, rocks or mountains, where people place coins, pebbles and votive ribbons while they make their prayers to 'a god unknown'. The most prominent of these is the pinnacled peak of Beshbarmaq dagh (Five Fingers Mountain).