When Hammurabi became king in 1792 BC, Babylon was a middle-ranking power surrounded by three more powerful political entities, namely the kingdoms of Larsa, Eshnunna, and Northern Mesopotamia.

To the southeast stretched the kingdom of Larsa, which had enjoyed considerable success since its founding by the chiefs of an Amorite tribe in the early second millennium BC, after the fall of the 3rd dynasty of Ur (2002 BC). The last king of Larsa, Rim-Sin, who conquered Uruk, annexed the kingdom of Isin (1794 BC), thus reconstituting Sumer’s political unity. Hammurabi, after raiding Isin and Uruk in 1784 BC, realized that he did not have sufficient military might to win a decisive victory over Rim-Sin. He therefore bided his time for twenty years.

To the northeast, the Diyala River valley linking the Mesopotamian plain to the Iranian plateau with its raw materials represented the backbone of the kingdom of Eshnunna, which underwent considerable expansion in the twentieth and nineteenth centuries BC.

To the northwest, Northern Mesopotamia had been unified by Shamshi-Adad, originally from Agade (Akkad). He headed up the Tigris valley, settled at Ekallatum, then annexed Ashur (1807 BC) and the entire area of the Khabur triangle. He then moved to Shekhna, which he renamed Shubat-Enlil (Tell Leilan), and wound up conquering the middle-Euphrates kingdom of Mari (circa 1792 BC).

Beyond these three neighbors, other major Near-Eastern powers—in western Syria and Iran—would also play a significant role in Babylon’s fate.

During the first eighteen years of his reign, Hammurabi governed the Babylonia he inherited from his father. At the death of Shamshi-Adad in 1775 BC, the kingdoms he had annexed recovered their independence. Zimri-Lim moved into Mari. At first, Eshnunna was the main beneficiary of the collapse of Shamshi-Adad’s empire. It king displayed a desire for domination that, after a few years, convinced the powerful emperor of Elam to invade Mesopotamia. The kings of Mari and Babylon came to his aid, only too happy to see the fall of their troublesome neighbor; Eshnunna fell in 1765 BC. But the Elamite emperor’s brutality made Hammurabi decide to change sides and, with the support of the kings of Mari and Aleppo, to oppose the emperor.

Hammurabi then attacked the king of Larsa, Rim-Sin. The kingdom of Babylon annexed Larsa and became the biggest power in the region. Hammurabi forced local kings in the Jebel Sinjar region to submit, then won a decisive victory over the king of Eshnunna in 1760 BC. The following year, Babylonian troops invaded the kingdom of Mari; after several months of occupation the palace, already emptied of its treasures, was put to the torch and the city was abandoned (1757 BC).

At that point, the Near East was divided into two zones of influence: Aleppo to the west and Babylon to the east. Hammurabi extended his zone of influence northward—the prologue to his Code claims that he controlled Nineveh and Ashur. At his death in 1750 BC, Hammurabi bequeathed his son Samsu-iluna a vast kingdom extending from the Gulf to the Middle Euphrates and the Middle Tigris. Samsu-iluna’s descendents more or less managed to maintain control of the valley of the Middle Euphrates as far as Terqa, but a shrinking territory and chronic problems of water supply weakened the kingdom’s economy. The Kassites, mercenaries originally from the Zagros Mountains, assumed growing importance in the army and wound up seizing the throne after a raid by the Hittite king Mursilis I put an end to the reign of Samsu-ditana shortly after 1600 BC.

Right from the start of his reign, Hammurabi was greatly concerned to embellish and furnish the various temples in Babylon, filling them with thrones, divine and royal statues, emblems, and processional chariots of precious metals and stones.

It is probable that the ziggurat—the terraced tower of the temple of Marduk in Babylon—existed in the days of Hammurabi, because there was another one associated with the temple of the sun at Sippar and other Babylonian cities. There is perhaps even an indirect allusion to it in the Code (Epilogue rev. XXIV, 67–69): “Babylon, the city whose turrets Anu[m] and Enlil raised; in Esagila, the temple whose foundations are firm as heaven and earth.” Esagila was the temple of Marduk—a reference to foundations as firm as heaven and earth may allude to another great part of Marduk’s sanctuary, the ziggurat, whose name Etemenanki means “house that is the foundation of heaven and earth.”

Hammurabi carried out major construction outside his capital. Canals and city walls were built, and the major Babylonian temples were restored, notably at Sippar where Hammurabi liked to dwell and consult the oracles of Shamash.

In the thirty-fourth year of his reign, Hammurabi’s son Samsu-iluna (r. 1749–1712 BC) built a new imperial palace whose exact location is not known. Nor is it known if he erected a new building or renovated and extended the royal palace of his ancestors. The old palace must have become too small and was probably used as an administrative center.

The walls of Babylon are mentioned for the first time during the reign of Ammi-ditana (1683–1647 BC). They were not merely placed under divine protection but were even deified, which reinforced their protective role. They were given an old name for Marduk, Asalluhe, which was uttered as a curse designed to terrify any enemy who envisaged destroying them. It may be that Babylon’s walls had nearly reached the layout that we know existed in the late second millennium BC and the Neo-Babylonian period. Ammi-ditana also erected a new palace, unless he merely rebuilt the palace mentioned by Samsu-iluna. Great intellectual activity developed in Babylon—several major texts of Mesopotamian literature are known from tablets written during his reign, including a hymn to Ishtar. Samsu-ditana (1625–1595 BC), the last king of Babylon’s first dynasty, reigned over a shrinking kingdom that collapsed at the end of his reign, during which there is no mention of any construction work.