Jerusalem is an ancient city located in ancient Judah that is now the capital of Israel. The city has a history that goes back to the 4th millennium BCE, making it one of the oldest cities in the world. It is the holiest city in Judaism and Christianity and has been the spiritual center of the Jewish people since c. 1000 BCE, when David the King of Israel first established it as the capital of the Jewish Nation, and his son Solomon commissioned the building of the First Temple in the city.
Ceramic evidence indicates the occupation of Ophel, within present-day Jerusalem, as far back as the Copper Age, c. 4th millennium BCE, with evidence of a permanent settlement during the early Bronze Age, c. 3000–2800 BCE. The Execration Texts (c. 19th century BCE), which refer to a city called Roshlamem or Rosh-ramen and the Amarna letters (c. 14th century BCE) may be the earliest mention of the city. According to Jewish tradition the city was founded by Shem and Eber, ancestors of Abraham. In the biblical account, when first mentioned, Jerusalem (known as "Salem") is ruled by Melchizedek, an ally of Abraham (identified with Shem in legend). Later, in the time of Joshua, Jerusalem was in territory allocated to the tribe of Benjamin (Joshua 18:28) but it continued to be under the independent control of the Jebusites until it was conquered by David and made into the capital of the united Kingdom of Israel (c. 1000s BCE).
According to Hebrew scripture, King David reigned until 970 BCE. He was succeeded by his son Solomon, who built the Holy Temple on Mount Moriah. During the so-called First Temple Period, Jerusalem was the political capital of firstly the united Kingdom of Israel and then the Kingdom of Judah and the Temple was the religious center of the Israelites. The First Temple period ended around 586 BCE, as the Babylonian ruler Nebuchadnezzar II laid waste to Solomon's Temple and took a significant number of Jews captive in response to a revolt. In 538 BCE, after fifty years of Babylonian captivity, Persian King Cyrus the Great invited the Jews to return to Judah to rebuild the Temple. Construction of the Second Temple was completed in 516 BCE, during the reign of Darius the Great, seventy years after the destruction of the First Temple.
When Macedonian ruler Alexander the Great conquered the Persian Empire, Jerusalem and Judea fell under Macedonian control, eventually falling to the Ptolemaic dynasty under Ptolemy I. In 198 BCE, Ptolemy V lost Jerusalem and Judea to the Seleucids under Antiochus III. The Seleucid attempt to recast Jerusalem as a Hellenized polis came to a head in 168 BCE with the successful Maccabean revolt of Mattathias the High Priest and his five sons against Antiochus Epiphanes, and their establishment of the Hasmonean Kingdom in 152 BCE with Jerusalem again as its capital.
As Rome became stronger it installed Herod as a Jewish client king. Herod the Great, as he was known, devoted himself to developing and beautifying the city. He built walls, towers and palaces, and expanded the Temple Mount, buttressing the courtyard with blocks of stone weighing up to 100 tons. Under Herod, the area of the Temple Mount doubled in size. In 6 CE, the city, as well as much of the surrounding area, came under direct Roman rule as the Iudaea Province and Herod's descendants through Agrippa II remained client kings of Judea until 96 CE. Emperor Hadrian romanized the city, renaming it Aelia Capitolina and banned the Jews from entering it. Hadrian renamed the entire Iudaea Province Syria Palaestina after the biblical Philistines in an attempt to de-Judaize the country. Enforcement of the ban on Jews entering Aelia Capitolina continued until the 4th century CE.
Until the 7th century CE the city repeatedly changed hands between the Roman Empire, the Byzantine Empire, and the Sassanid Empire. In 638 the Islamic Caliphate extended its dominion to Jerusalem, which is considered Islam's third holiest city after Mecca and Medina. With the Arab conquest, Jews were allowed back into the city. Until the Crusades Jerusalem remained under Arab control.