The Great Hymn to Shamash is a Babylonian composition of some two hundred lines, preserved in its fullest form on tablets from the seventh-century library of Ashurbanipal at Nineveh though clearly older. Shamash is the sun god, and the hymn draws from that a single sustained idea: because the sun sees everything, crossing the whole earth each day and reaching into places hidden from other eyes, he is the god of justice. He is invoked as the one before whom oaths are sworn, who watches the honest merchant and the corrupt judge alike, who lights the way of the traveller and reads the intentions of the wicked.
The hymn is notable within Mesopotamian literature for its ethical seriousness. It praises the just and warns the unjust in concrete social detail, the merchant who cheats with false weights, the judge who takes a bribe, the official who oppresses the weak, and promises the sun's favour to those who deal rightly. That linkage of a natural power (the all-seeing sun) with a moral function (impartial justice) is one of the oldest and most durable moves in the history of religion, and this hymn is among its clearest ancient expressions.
Shamash's dual role as sun god and god of justice also made him the patron of the scribes who drew up legal documents and of kings who claimed their laws as divinely sanctioned; the Babylonian king Hammurabi is depicted receiving the symbols of authority directly from Shamash on the stele that records his famous law code. The hymn's insistence that the sun's light exposes wrongdoing even in darkness or in hidden places gave later Mesopotamian legal and administrative texts a ready religious warrant for treating impartial judgment as a divine, not merely human, standard.