Islam originated in the 7th century CE at Jabal al-Nour, a mountain peak near Mecca, Saudi Arabia where Muhammad's first revelation is said to have taken place. Affected by the ills of society and after becoming financially secure through marrying his employer, the businesswoman Khadija, he began retreating to a cave to contemplate. During the last 22 years of his life, beginning at age 40 in 610 CE, Muhammad reported receiving revelations from God, conveyed to him through the archangel Gabriel. Muhammad being illiterate, had several of his companions serving as scribes, recording the revelations. Shortly after the prophet's death, the Quran was compiled by the companions who had written down or memorized parts of it. Caliph Uthman established a standard version, now known as the Uthmanic codex, which is generally considered the archetype of the Quran known today.
Through various caliphates, the religion of Islam later spread outside of Arabia shortly after Muhammad's death, and by the 8th century, the Umayyad Caliphate had imposed Islamic rule from the Iberian Peninsula in the west to the Indus Valley in the east. The Islamic Golden Age refers to the period traditionally dated from the 8th century to the 13th century, during the reign of the Abbasid Caliphate, when much of the Muslim world was experiencing a scientific, economic, and cultural flourishing. The vast Abbasid empire proved impossible to hold together. Soldiers established their own dynasties, such as the Tulunids, Samanid and Ghaznavid dynasty. With the Fatimid dynasty taking control of North Africa, and with the Qarmatians sacking Mecca and stealing the Black Stone in their unsuccessful rebellion, further splintering of the religion continued.
Through Muslim trade networks and the activity of Sufi orders, Islam spread into new areas. Under the Ottoman Empire, Islam spread to Southeast Europe. Muslim Turks incorporated elements of Turkish Shamanism beliefs to Islam. Muslims in China, who were descended from earlier immigrants, were assimilated, sometimes by force, by adopting Chinese names and culture while Nanjing became an important center of Islamic study.
While cultural influence used to radiate outward from Baghdad, after the Mongol destruction of the Abbasid Caliphate, Arab influence decreased. Iran and Central Asia, benefiting from increased cross-cultural access to East Asia under Mongol rule, flourished and developed more distinctively from Arab influence, such as the Timurid Renaissance under the Timurid dynasty.
The introduction of gunpowder weapons led to the rise of large centralized states and the Muslim Gunpowder empires consolidated much of the previously splintered territories. The caliphate was claimed by the Ottoman dynasty of the Ottoman Empire since Murad I's conquest of Edirne in 1362, and its claims were strengthened in 1517 as Selim I became the ruler of Mecca and Medina. The Shia Safavid dynasty rose to power in 1501 and later conquered all of Iran. In South Asia, Babur founded the Mughal Empire. The Mughals made major contributions to Islamic architecture, including the Taj Mahal and Badshahi mosque, and compiled the Fatwa Alamgiri.