The military successes of Hammurabi fall within two clearly defined periods, the first during the five years which followed his sixth year of rule at Babylon, and a second period, of ten years' duration, beginning with the thirteenth of his reign. On his accession he appears to have inaugurated the reforms in the internal administration of the country, which culminated towards the close of his life in the promulgation of his famous Code of Laws; for he commemorated his second year as that in which he established righteousness in the land. The following years were uneventful, the most important royal acts being the installation of the chief-priest in Kashbaran,[81] the building of a wall for the Gagûm, or great Cloister of Sippar, and of a temple to Nannar in Babylon. But with his seventh year we find his first reference to a military campaign in a claim to the capture of Erech and Nîsin. This temporary success against Damik-ilishu of Nîsin was doubtless a menace to the plans of Rîm-Sin at Larsa, and it would appear that Kudur-Mabuk came to the assistance of his son by threatening Babylon's eastern border. At any rate Hammurabi records a conflict with the land of Emutbal in his eighth year, and, though the attack appears to have been successfully repulsed with a gain of territory to Babylon,[82] the diversion was successful. Rîm-Sin took advantage of the respite thus secured to renew his attack with increased vigour upon Nîsin, and in the following year, the seventeenth of his own reign, the famous city fell, and Larsa under her Elamite ruler secured the hegemony in the whole of Central and Southern Babylonia.

Rîm-Sin's victory must have been a severe blow to Babylon, and it would seem that she made no attempt at first to recover her position in the south, since Hammurabi occupied himself with a raid on Malgûm[83] in the west and with the capture of the cities of Rabikum and Shalibi. But these were the last successes during his first military period, and for nineteen years afterwards Babylon achieved nothing of a similar nature to commemorate in her date-formulæ. For the most part the years are named after the dedication of statues and the building and enrichment of temples. One canal was cut,[84] and the process of fortification went on, Sippar especially being put in a thorough state of defence.[85] But the negative evidence supplied by the formulæ for this period suggests that it was one in which Babylon completely failed in any attempt she may have made to hinder the growth of Larsa's power in the south.

In addition to his capital, Rîm-Sin had inherited from his brother the control of the southern group of cities, Ur, Erech, Girsu and Lagash, all of which lay to the east of Larsa and nearer to the coast; and it was probably before his conquest of Nîsin that he took Erech from Damiḳ-ilishu, who had been attacked there by Hammurabi two years before. For in more than one of his inscriptions Rîm-Sin refers to the time when Anu, Enlil and Enki, the great gods, had given the fair city of Erech into his hands.[86] We also know that he took Kisurra, rebuilt the wall of Zabilum, and extended his authority over Kesh, whose goddess Ninmakh, he relates, gave him the kingship over the whole country.[87] The most notable result of his conquest of Nîsin was the possession of Nippur, which now passed to him and regularized his earlier claim to the rule of Sumer and Akkad. Thereafter he describes himself as the exalted Prince of Nippur, or as the shepherd of the whole land of Nippur; and we possess an interesting confirmation of his recognition there in a clay cone inscribed with a dedication for the prolongation of his life by a private citizen, a certain Ninib-gamil.[88]

That Rîm-Sin's rule in Sumer was attended by great prosperity throughout the country as a whole, is attested by the numerous commercial documents which have been recovered both at Nippur and Larsa and are dated in the era of his capture of Nîsin. There is also evidence that he devoted himself to improving the system of irrigation and of transport by water. He canalized a section in the lower course of the Euphrates, and dug the Tigris to the sea, no doubt removing from its main channel an accumulation of silt, which not only hindered traffic but increased the danger of flood and the growth of the swamp-area. He also cut the Mashtabba Canal, and others at Nippur and on the Khabilu river.[89] It would seem that, in spite of his Elamite extraction and the intimate relations he continued to maintain with his father Kudur-Mabuk, he completely identified himself with the country of his adoption; for in the course of his long life he married twice, and both his wives, to judge from their fathers' names, were of Semitic descent.[90]

It was not until nearly a generation had passed, after Rîm-Sin's capture of Nîsin, that Hammurabi made any headway against the Elamite domination, which for so long had arrested any increase in the power of Babylon.[91] But his success, when it came, was complete and enduring. In his thirtieth year he records that he defeated the army of Elam, and in the next campaign he followed up this victory by invading the land of Emutbal, inflicting a final defeat on the Elamites, and capturing and annexing Larsa. Rîm-Sin himself appears to have survived for many years, and to have given further trouble to Babylon in the reign of Hammurabi's son, Samsu-iluna.—And the evidence seems to show that for a few years at least he was accorded the position of vassal ruler at Larsa.[92] On this supposition Hammurabi, after his conquest of Sumer, would have treated the old capital in the same way that Sumu-abum treated Kish.[93] But it would seem that after a time Larsa must have been deprived of many of its privileges, including that of continuing its own era of time-reckoning; and Hammurabi's letters to Sin-idinnam, his local representative, give no hint of any divided rule. We may perhaps assume that Rîm-Sin's subsequent revolt was due to resentment at this treatment, and that in Samsu-iluna's reign he seized a favourable opportunity to make one more bid for independent rule in Babylonia.

The defeat of Rîm-Sin, and the annexation of Sumer to Babylon, freed Hammurabi for the task of extending his empire on its other three sides. During these later years he twice made successful raids in the Elamite country of Tupliash or Ashnunnak, and on the west he destroyed the walls of Mari and Malgûm, defeated the armies of Turukkum, Kagmum and Subartu, and in his thirty-ninth year he records that he destroyed all his enemies that dwelt beside Subartu. It is probable that he includes Assyria under the geographical term Subartu, for both Ashur and Nineveh were subject to his rule; and one of his letters proves that his occupation of Assyria was of a permanent character, and that his authority was maintained by garrisons of Babylonian troops. Hammurabi tells us too, in the Prologue to his Code of Laws, that he subjugated "the settlements on the Euphrates," implying the conquest of such local West-Semitic kingdoms as that of Khana.[94] On the west we may therefore regard the area of his military activities as extending to the borders of Syria. Up to the close of his reign he continued to improve the defences of his country, for he devoted his last two years to rebuilding the great fortification of Kâr-Shamash on the Tigris and the wall of Rabikum on the Euphrates, and he once again strengthened the city-wall of Sippar. His building-inscriptions also bear witness to his increased activity in the reconstruction of temples during his closing years.[95]

An estimate of the extent of Hammurabi's empire may be formed from the very exhaustive record of his activities which he himself drew up as the Prologue to his Code. He there enumerates the great cities of his kingdom and the benefits he has conferred upon each one of them. The list of cities is not drawn up with any administrative object, but from a purely religious standpoint, a recital of his treatment of each city being followed by a reference to what he has done for its temple and its city-god. Hence the majority of the cities are not arranged on a geographical basis, but in accordance with their relative rank as centres of religious cult. Nippur naturally heads the list, and its possession at this time by Babylon had, as we shall see,[96] far-reaching effects upon the development of the mythology and religious system of the country. Next in order comes Eridu, in virtue of the great age and sanctity of its local oracle. Babylon, as the capital, comes third, and then the great centres of Moon-and Sun-worship, followed by the other great cities and shrines of Sumer and Akkad, the king characterizing the benefits he has bestowed on each. The list includes some of his western conquests and ends with Ashur and Nineveh.[97] It is significant of the racial character of his dynasty that Hammurabi should here ascribe his victories on the middle Euphrates to "the strength of Dagan, his creator," proving that, like his ancestors before him, he continued to be proud of his West-Semitic descent.

In view of the closer relations which had now been established between Babylonia and the West, it may be interesting to recall that an echo from these troubled times found its way into the early traditions of the Hebrews, and has been preserved in the Book of Genesis. It is there related[98] that Amraphel king of Shinar, Arioch king of Ellasar, Chedorlaomer king of Elam, and Tidal king of Goiim or the "nations," acting as members of a confederation, invaded Eastern Palestine to subdue the revolted tribes of that district. Chedorlaomer is represented as the head of the confederation, and though we know of no Elamite ruler of that name, we have seen that Elam at about this period had exercised control over a great part of Southern and Central Babylonia, and that its Babylonian capital was the city of Larsa, with which the Ellasar of the Hebrew tradition is certainly to be identified.[99] Moreover, Kudur-Mabuk, the historical founder of the Elamite domination in Babylonia, did lay claim to the title of Adda or ruler of the Amorites.[100] Amraphel of Shinar may well be Hammurabi of Babylon himself, though, so far from acknowledging the suzerainty of the Elamites, he was their principal antagonist and brought their domination to an end. Tidal is a purely Hittite name,[101] and it is significant that the close of Hammurabi's powerful dynasty was, as we shall see presently, hastened by an invasion of Hittite tribes. Thus all the great nations which are mentioned in this passage in Genesis were actually on the stage of history at this time, and, though we have as yet found no trace in secular sources of such a confederation under the leadership of Elam, the Hebrew record represents a state of affairs in Western Asia which was not impossible during the earlier half of Hammurabi's reign.[102]

While Sumu-la-ilum may have laid the foundations of Babylon's military power, Hammurabi was the real founder of her greatness. To his military achievements he added a genius for administrative detail, and his letters and despatches, which have been recovered, reveal him as in active control of even subordinate officials stationed in distant cities of his empire. That he should have superintended matters of public importance is what might be naturally expected; but we also see him investigating quite trivial complaints and disputes among the humbler classes of his subjects, and often sending back a case for retrial or for further report. In fact, Hammurabi's fame will always rest on his achievements as a law-giver, and on the great legal code which he drew up for use throughout his empire. It is true that this elaborate system of laws, which deal in detail with every class of the population from the noble to the slave, was not the creative work of Hammurabi himself. Like all other ancient legal codes it was governed strictly by precedent, and where it did not incorporate earlier collections of laws, it was based on careful consideration of established custom. Hammurabi's great achievement was the codification of this mass of legal enactments and the rigid enforcement of the provisions of the resulting code throughout the whole territory of Babylonia. Its provisions reflect the king's own enthusiasm, of which his letters give independent proof, in the cause of the humbler and the more oppressed classes of his subjects. Numerous legal and commercial documents also attest the manner in which its provisions were carried out, and we have evidence that the legislative system so established remained in practical force during subsequent periods. It may be well, then, to pause at the age of Hammurabi, in order to ascertain the main features of early Babylonian civilization, and to estimate its influence on the country's later development.