Islam arrived in Azerbaijan with Arabs in the seventh century, gradually supplanting Christianity and pagan cults.
In the sixteenth century, the first shah of the Safavid Dynasty, Ismail I (r. 1486-1524), established Shi'a Islam as the state religion, although a portion of people remained Sunni. The population of what is nowadays Iran and what is nowadays Azerbaijan were converted to Shia Islam at the same moment in history.
As elsewhere in the Muslim world, the two branches of Islam came into conflict in Azerbaijan. Enforcement of Shi'a Islam as the state religion brought contention between the Safavid rulers 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.Iranian religious influences.
Thus, by the late nineteenth century, the Shi'a population was in the majority in Russian Azerbaijan. Antagonism between the Sunnis and the Shi'a diminished in the late nineteenth century as Azerbaijani nationalism began to emphasize a common Turkic heritage and opposition to
Russian Empire and Soviet Union
In 1806, what is now Azerbaijan became occupied by the Russian Empire as the latter invaded Qajar Iran during the Russo-Persian War (1804-1813). In the aftermath, Iran was forced to cede therefore almost all of what is nowadays Azerbaijan according to the Treaty of Gulistan of 1813 to Russia. However, all this only came to be confirmed in the aftermath of the next and last war between Russia and Iran, the Russo-Persian War (1826-1828) and the resulting Treaty of Turkmenchay of 1828. In 1918, what is now Azerbaijan declared independence from Russia and established the Azerbaijan Democratic Republic under its leading Musavat party, but was incorporated into the Soviet Union in 1920.
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. The Soviet rule promoted an Azerbaijani national consciousness as a substitute for identification with the world Islamic community.
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 nineteenth-century tsarist
Muslim Ecclesiastical Board. During the tenures of Leonid Brezhnev and Mikhail 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.
During the Azerbaijani SSR, there were 17 mosques functioning in the country. In the 1980s 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.
The lone center of conservative Shia Islam, was the town of Nardaran, 25 kilometers northeast of central Baku, and was renowned for its thirteenth-century Shia shrine. Unlike the rest of the country which was staunchly secular and which can be considered religiously progressive, Nardaran was the only place in the whole of Azerbaijan where its inhabitants are devoutly religious and fundamentalist, where its streets display religious banners and where most women wear chadors in public. The now banned Islamic Party of Azerbaijan was founded in this town and its base was centered there.
There is some evidence of Sufism in Azerbaijan.
Gradually, during the Soviet imperial twilight, signs of religious reawakening not only multiplied but surfaced into the open. According to Soviet sources, during the late 1970s around 1,000 clandestine houses of prayer were in use, and some 300 places of pilgrimage were identifiable. This growth proved the prelude to the public openings of hundreds of mosques in the following decade.
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 Qur'ans and religious instructors to the new Muslim states. A Muslim seminary has also been established since 1991. The growing number of religious Muslims resulted in the establishment of more than 2,000 mosques by 2014.
After independence, the laws regarding religion are quite clear. In Article 7 of the constitution, Azerbaijan is declared a secular state. This point is driven home in Article 19 with the statement of the separation of religion and state and the equality of all religions before the law as well as the secular character of the state educational system.
Azerbaijan has been a secular country. A 1998 survey estimated the proportion of ardent believers in Azerbaijan at close to 7 percent, slightly more than the number of declared atheists — almost 4 percent — with the largest numbers falling into the category of those who consider Islam above all as a way of life, without strict observance of prohibitions and requirements, or as a fundamental part of national identity. In a 2010 survey only half of Azerbaijanis answering yes to the question, "Is religion an important part of your daily life?"
Secular politicians in Azerbaijan have raised concerns about the rise of political Islam, but others argue that Islam in Azerbaijan is a multifaceted phenomenon. Islam plays only a very limited role in the political sphere and only a small part of the population supports the idea of establishing an "Islamic order". This is due to the long tradition of secularism in Azerbaijan and to the fact that the nationalistic opposition movement is secular in character. Yet, according to some analysts, on the longer run, if the politicians do not manage to improve the conditions of life of the vast majority of the people, the population may express its discontent through political Islam.