During its long history, Jerusalem has been destroyed at least twice, besieged 23 times, attacked 52 times, and captured and recaptured 44 times. The part of Jerusalem called the City of David was settled in the 4th millennium BCE. Jerusalem was named as "Urusalim" on ancient Egyptian tablets, probably meaning "City of Shalem" after a Canaanite deity, during the Canaanite period (14th century BCE). During the Israelite period, significant construction activity in Jerusalem began in the 9th century BCE (Iron Age II), and in the 8th century the city developed into the religious and administrative center of the Kingdom of Judah. In 1538, the city walls were rebuilt for a last time around Jerusalem under Suleiman the Magnificent. Today those walls define the Old City, which has been traditionally divided into four quarters—known since the early 19th century as the Armenian, Christian, Jewish, and Muslim Quarters. The Old City became a World Heritage Site in 1981, and is on the List of World Heritage in Danger. Since 1860 Jerusalem has grown far beyond the Old City's boundaries. In 2015, Jerusalem had a population of some 850,000 residents, comprising approximately 200,000 secular Jewish Israelis, 350,000 Haredi Jews and 300,000 Palestinians. In 2011, the population numbered 801,000, of which Jews comprised 497,000 (62%), Muslims 281,000 (35%), Christians 14,000 (around 2%) and 9,000 (1%) were not classified by religion.
According to the Bible, King David conquered the city from the Jebusites and established it as the capital of the united kingdom of Israel, and his son, King Solomon, commissioned the building of the First Temple. These foundational events, straddling the dawn of the 1st millennium BCE, assumed central symbolic importance for the Jewish people. The sobriquet of holy city (עיר הקודש, transliterated ‘ir haqodesh) was probably attached to Jerusalem in post-exilic times. The holiness of Jerusalem in Christianity, conserved in the Septuagint which Christians adopted as their own authority, was reinforced by the New Testament account of Jesus's crucifixion there. In Sunni Islam, Jerusalem is the third-holiest city, after Mecca and Medina. In Islamic tradition, in 610 CE it became the first qibla, the focal point for Muslim prayer (salat), and Muhammad made his Night Journey there ten years later, ascending to heaven where he speaks to God, according to the Quran. As a result, despite having an area of only 0.9 square kilometres (0.35 sq mi), the Old City is home to many sites of seminal religious importance, among them the Temple Mount with its Western Wall, Dome of the Rock and al-Aqsa Mosque, and the Church of the Holy Sepulchre. Outside the Old City stands the Garden Tomb.
Today, the status of Jerusalem remains one of the core issues in the Israeli–Palestinian conflict. During the 1948 Arab–Israeli War, West Jerusalem was among the areas captured and later annexed by Israel while East Jerusalem, including the Old City, was captured and later annexed by Jordan. Israel captured East Jerusalem from Jordan during the 1967 Six-Day War and subsequently annexed it into Jerusalem, together with additional surrounding territory. One of Israel's Basic Laws, the 1980 Jerusalem Law, refers to Jerusalem as the country's undivided capital. All branches of the Israeli government are located in Jerusalem, including the Knesset (Israel's parliament), the residences of the Prime Minister (Beit Aghion) and President (Beit HaNassi), and the Supreme Court. While the international community rejected the annexation as illegal and treats East Jerusalem as Palestinian territory occupied by Israel, Israel has a stronger claim to sovereignty over West Jerusalem.
A city called Rušalim in the execration texts of the Middle Kingdom of Egypt (c. 19th century BCE) is widely, but not universally, identified as Jerusalem. Jerusalem is called Urušalim in the Amarna letters of Abdi-Heba (1330s BCE).
The name "Jerusalem" is variously etymologized to mean "foundation (Sumerian yeru, 'settlement'/Semitic yry' 'to found, to lay a cornerstone') of the god Shalem"; the god Shalem was thus the original tutelary deity of the Bronze Age city.