History and meaning
The name simply means "sun" (cognate to Hebrew shemesh and Arabic shams). Both in early and in late inscriptions Shamash is designated as the "offspring of Nannar"; i.e. of the moon-god, and since, in an enumeration of the pantheon, Sin generally takes precedence of Shamash, it is in relationship, presumably, to the moon-god that the sun-god appears as the dependent power. Such a supposition would accord with the prominence acquired by the moon in the calendar and in astrological calculations, as well as with the fact that the moon-cult belongs to the nomadic and therefore earlier stage of civilization, whereas the sun-god rises to full importance only after the agricultural stage has been reached. The two chief centres of sun-worship in Babylonia were Sippar, represented by the mounds at Abu Habba, and Larsa, represented by the modern Senkerah. At both places the chief sanctuary bore the name E-barra (or E-babbara) "the shining house" – a direct allusion to the brilliancy of the sun-god. Of the two temples, that at Sippara was the more famous, but temples to Shamash were erected in all large centres – such as Babylon, Ur, Mari, Nippur, and Nineveh. Another reference to Shamash is the Babylonian epic Gilgamesh. When Gilgamesh and Enkidu travel to slay Humbaba, each morning they pray and make libation to shamash in the direction of the rising sun for safe travels.
The attribute most commonly associated with Shamash is justice. Just as the sun disperses darkness, so Shamash brings wrong and injustice to light. Hammurabi attributes to Shamash the inspiration that led him to gather the existing laws and legal procedures into a code, and in the design accompanying the code the king represents himself in an attitude of adoration before Shamash as the embodiment of the idea of justice. Several centuries before Hammurabi, Ur-Engur of the Ur dynasty (c. 2600 BC) declared that he rendered decisions "according to the just laws of Shamash."
It was a logical consequence of this conception of the sun-god that he was regarded also as the one who released the sufferer from the grasp of the demons. The sick man, therefore, appeals to Shamash as the god who can be depended upon to help those who are suffering unjustly. This aspect of the sun-god is vividly brought out in the hymns addressed to him, which are, therefore, among the finest productions in the entire realm of Babylonian literature. It is evident from the material at our disposal that the Shamash cults at Sippar and Larsa so overshadowed local sun-deities elsewhere as to lead to an absorption of the minor deities by the predominating one. In the systematized pantheon these minor sun-gods become attendants that do his service. Such are Bunene, spoken of as his chariot driver and whose consort is Atgi-makh, Kettu ("justice") and Mesharu ("right"), who were then introduced as attendants of Shamash. Other sun-deities such as Ninurta and Nergal, the patron deities of other important centers, retained their independent existences as certain phases of the sun, with Ninurta becoming the sun-god of the morning and spring time and Nergal the sun-god of the noon and the summer solstice. In the wake of such syncretism Shamash was usually viewed as the sun-god in general.
Together with Nannar-Sin and Ishtar, Shamash completes another triad by the side of Anu, Enlil and Ea. The three powers Sin, Shamash and Ishtar symbolized three great forces of nature: the moon, the sun, and the life-giving force of the earth, respectively. At times instead of Ishtar we find Adad, the storm-god, associated with Sin and Shamash, and it may be that these two sets of triads represent the doctrines of two different schools of theological thought in Babylonia which were subsequently harmonized by the recognition of a group consisting of all four deities.
The consort of Shamash was known as Aya. She is, however, rarely mentioned in the inscriptions except in combination with Shamash.