The protagonist of the world's oldest known epic is Gilgamesh, the legendary king of Uruk.
The Epic of Gilgamesh grew from earlier Sumerian poems about a ruler named Gilgamesh, or Bilgames, and was later shaped into an Akkadian epic. The surviving Old Babylonian version dates to around the 18th century BCE, while the better-known Standard Babylonian version was compiled later. Gilgamesh begins as a powerful but oppressive king; his friendship with Enkidu transforms him, and Enkidu's death sends him searching for a way to escape mortality.
Ur-Nammu and Hammurabi were historical Mesopotamian kings associated with law and administration, not the epic's hero. Sargon was also a historical ruler and empire-builder. Gilgamesh may have been based on a real king of Uruk, but the supernatural adventures in the poem belong to mythology. The epic's flood narrative also introduces Utnapishtim, whom Gilgamesh visits while seeking the secret of eternal life.