Babylon was a minor place until the Amorite dynasty of Hammurabi made it a capital in the eighteenth century BCE, and its law collection, set up on a stele beneath a relief of the king before the sun god, is the best known legal document of the ancient world. The city was sacked, ruled by Kassites, dominated by Assyria, and then rebuilt on an imperial scale by Nabopolassar and Nebuchadnezzar II. That later Babylon is the one Robert Koldewey's excavations from 1899 uncovered, including the Ishtar Gate now reconstructed in Berlin.
The same empire carried out the deportations from Judah, and with them the most consequential encounter in the city's religious history. The exile shaped the Hebrew Bible, gave Judaism a diaspora, and left Babylon in Jewish and later Christian literature as the type of the worldly imperial city, a usage that reaches the Book of Revelation and travels far beyond it.
Cyrus took the city in 539 BCE without a siege, and the cuneiform scribal tradition continued under Persian, Greek and Parthian rule, with the last dated astronomical tablets falling in the first century of the common era. Andrew George's edition of the Gilgamesh epic shows how much of that tradition was still being copied late. The Jewish academies of Mesopotamia afterwards produced the Babylonian Talmud, which carries the name of a place whose gods it does not mention.