Mecca's recorded origins are vague, but evidence suggests it existed as early as 30 BC, when Greek historian Diodorus Siculus wrote of Bakkah and a holy shrine revered by inhabitants in a narrow valley on the Arabian Peninsula.

Islamic tradition holds that Mecca dates back even further, to 2000 BC, when Ibrahim (Abraham) rebuilt the Kaaba (House of God), the holy shrine that all Muslims face when performing prayers five times a day. By the 5th century AD, the Quraysh tribe ruled Mecca and the city became known for its savvy spice merchants, who developed overland trade routes to avoid pirates at sea. The birth of Muhammad in AD 570 would forever transform Mecca from a trading post with a notable temple to the birthplace and centre of Islam, though this didn't happen immediately. By the time of Muhammad's birth Mecca's inhabitants had become known for their worship of numerous pagan deities, though some historians claim they still revered a high God, Allah. Muhammad was in his 40s when the revelations began as he sat in a cave on Jabal Al Nour, the Mountain of Light. For the next 13 years, he endured much persecution as he tried to persuade the Quraysh tribes of Mecca to accept his message, before ultimately departing for Medina.

Following several battles between Mecca and Medina, in which his forces were ultimately victorious, Muhammad returned in AD 630 with a 10,000-man army. The Quraysh surrendered the city and Muhammad and his men were allowed to come in and rid the Kabaa of the pagan idols, perform hajj and declare Mecca a Muslim-only city. Nowadays, when those same rites of the hajj are performed, Mecca’s population swells to nearly 4.5 million.