The Epic of Gilgamesh is an epic narrative poem written in ancient Mesopotamia. It is loosely based on the life of the real king of Uruk (modern day Iraq). The epic is derived from several earlier poems written about Gilgamesh, which serve as a background for the events in the Epic of Gilgamesh. The story has been recovered mainly from twelve stone tablets; fragments from several other versions found have added some missing details to create a more comprehensive story, although even today some parts of it are missing. The story deals with a fictionalized version of King Gilgamesh, his friendship with Enkidu, and his failed quest for immortality following the death of Enkidu.
Gilgamesh, King of Uruk, is two-thirds god and one-third man, and mortal. His people cry out to the gods for protection, as Gilgamesh has a habit of taking whatever woman he wants, married or not, and forcing the men of his city into battles or construction on grand buildings. The gods answer their prayers by creating out of clay a man in equal strength to Gilgamesh. This wild man, who lives with wild animals and is named Enkidu, attracts attention when he uproots traps belonging to a local hunter. The hunter sends Shamhat, a temple prostitute, to seduce Enkidu, as he believes this will tame him. Enkidu has sex with her for seven days straight, after which time the animals will no longer approach him, because he is no longer one of them. She suggests that he join with civilization. Gilgamesh, meanwhile, has been dreaming about meeting a new companion.
Enkidu has been working as a shepard, protecting the livestock of a small village, when he hears of how Gilgamesh rapes women on their wedding day. Furious, he leaves for Uruk, and when Gilgamesh tries to enter the wedding chamber he is blocked by Enkidu, and the two fight. However, upon realizing each other's strength, they decide instead to be friends. Gilgamesh proposes that the two travel to the Cedar Forest to slay the demi-god Humbaba. Though the elders and Enkidu disagree with this idea, Gilgamesh cannot be persuaded. Gilgamesh's mother, the goddess Ninsun, offers her blessing for the adventure, and adopts Enkidu as her child, making he and Gilgamesh brothers. Ninsun seeks the protection of the sun god for her sons and is left instructions on governing the city for the duration of their travels.
The pair travels to the Cedar Forest and perform a dream ritual. Gilgamesh has five dreams of the mountain falling, storms, and other calamities. Enkidu interprets these as good omens, and the two fight Humbaba, aided by Shamash, the sun god. When he is nearly slain, Humbaba begs for his life. Gilgamesh hesitates, but Enkidu angrily urges him to finish off the demi-god, which Gilgamesh does. The two cut down the forbidden cedar trees Humbaba had been guarding, setting aside one to be used as the door to a new temple, and the rest are made into a raft the two use to return home.
Gilgamesh attracts the attention of Ishtar, the goddess of fertility, but he rejects her, as her lovers often meet ill fates. She asks her father to release the Bull of Heaven on the lands as punishment. He refuses, but she threatens to raise the dead and have them overrun the world of the living, so he relents. However, the Bull of Heaven is also slain by Gilgamesh and Enkidu, enraging the goddess further.
Because the two have killed Humbaba and the Bull of Heaven in defiance of the gods, the gods decide one of them must die, and Enkidu is marked for death. He wanders out of the city, weakens gradually, dreaming of the Angel of Death dragging him to the afterlife, a world where souls crawl on their bellies and eat dust. Enkidu eventually dies, upset that he was not granted a magnificent death in battle.
Gilgamesh, mad with grief and now terrified of his own mortality, dons animal skins and sets off into the wilderness. He attempts to find Utnapishtim, the Mesopotamian Noah who survived the Great Flood by building a great ark and taking his family and livestock aboard. He was given immortality by the gods. Two scorpion monsters allow Gilgamesh to pass through the path to Utnapishtim after learning of his divine ancestry. After travelling in darkness through the path, he arrives at a beautiful garden by the sea. He speaks with the goddess Siduri at her tavern, and she attempts to dissuade him from his quest for immortality, saying that immortality would leave humankind unable to appreciate any pleasures of the world. When he will not be dissuaded, she gives him directions to Urshanabi, the ferryman. Urshanabi takes Gilgamesh across the sea to meet Utnapishtim.
Utnapishtim tells Gilgamesh the story of the Great Flood, how the gods decided to flood the world and eradicate mankind. However, Ea, the god of wisdom, warns Utnapishtim of the flood and instructs him to build an arc and take his family and livestock aboard. The gods regret flooding the world and vow to never wipe out humanity. Utnapishtim was granted immortality by the gods as a reward for his faith.
When Gilgamesh insists that he too be able to live forever, Utnapishtim gives him a test; if Gilgamesh is worthy of eternal life, he should be able to stay away for a week. Gilgamesh falls asleep, however. Utnapishtim orders him to clean himself, dresses him in royal robes, and sends him back to Uruk. However, Utnapishtim's wife convinces him to tell Gilgamesh about an underwater plant which will restore youth. Gilgamesh takes the plant by anchoring himself to large rocks to help him sink to the bottom of the water. Gilgamesh intends to use it on the elders of Uruk, and eventually, himself. However, as he lies sleeping on his return travels, a snake steals the plant.
Gilgamesh returns to Uruk without the plant and resigns himself to his mortality. He sees the city of Uruk as a beautiful achievement, one that will last ages, which is a form of immortality in and of itself, as it continues to serve the human race which will never die out.