One of the duties of a Mesopotamian king was to care for the gods and restore or rebuild their temples. In the late third millennium BC, rulers in southern Mesopotamia often depicted themselves carrying out this pious task in the form of foundation pegs. Foundation pegs were buried in the foundation of buildings to magically protect them and preserve the builder's name for posterity. In this case, the peg is supported by a god (Mesopotamian gods are usually depicted wearing horned headdresses). The peg has a very faint cuneiform inscription of Gudea, the ruler of the city-state of Lagash. Gudea ruled at a time when the cities of southern Mesopotamia, which had been united under the empire of Agade (Akkad), were reasserting their independence. There was competition among powerful, rival city-rulers for prominence. Of these, we know most about Gudea; he was a prolific builder and some of the longest Sumerian literary texts were written during his reign. Despite his wealth, however, Gudea's rule was limited to the area of his own city, which was soon absorbed into the new empire of Ur (called the Third Dynasty of Ur).