Stephan Maul summarizes the ritual that an ancient Mesopotamian would have to go through to be released from the displeasure of the gods, which was communicated to the person by a bad omen (a barking dog, a growling cat, etc.). The key portion of the rite was played out before Shamash, the god of the sun, who was also the god of law and justice. After all, Shamash sees everything during his circuit through the sky, and even traverses the realm of darkness each night.
Maul writes, “One thus went before the highest judge Samas together with one’s opponent, the harbinger or its image, which was formally considered to have the same rights as the person. In none of the preformulated prayers, with which a person in the namburbi rituals entreated Samas or Ea and Asalluhi, is doubt cast upon the correctness and validity of the divine judgement which, by means of the evil omen, would bestow an unhappy future upon the affected person. Instead, the affected person attempted to effect a revision of the judgement. A new judgement was then supposed to give him a better fate. Samas was asked to effect a revision of the divine judgement. This next part of the ritual is nothing other than a trial in which the affected person as well as his opponent, i.e. the harbinger, appear before the highest divine judge. In this trial, the affected person attempted to renegotiate the gods’ disadvantageous decision regarding his future, a decision which had to a certain degree legally empowered the harbinger to bring harm upon him. This decision was now to be reconsidered and corrected in favour of the person affected, even before he could receive any recognisable injury. The harbinger on the other hand was to be condemned and thereupon destroyed.” Once Shamash had made a decision, “no one, not even another god, can challenge or alter Samas’s judgement once rendered” (125-6).
As judge, Shamash justifies or condemns, shows favor or turns a dark face toward the accused. Shamash could release a person from an ill fate, and ensure a prosperous future. To turn to the sun was to seek a favorable verdict. Perhaps this is what some ancients would have heard when they heard the Psalmist boast that Yahweh is “a sun and a shield; He gives grace and glory.”
(Maul, “How the Babylonians Protected Themselves against Calamities Announced by Omens,” in T. Abusch, et. al., eds., Mesopotamian Magic [Groningen, 1999] 123-129.)