Your question implies that there are elements of this ancient story that do not comply with the definition of an epic. However, Gilgamesh is considered by nearly all critics as a defining example of an epic. It is believed to be based on a grain of truth in that Gilgamesh supposedly was an actual king who reigned over the city-state of Uruk, in Sumer, sometime between 2700 and 2500 BC. Gradually, over the centuries, King Gilgamesh became a legendary figure, rather like King Arthur. Tales of Gilgamesh's exploits grew and were probably recited in verse for centuries before they were recorded in writing, thus it was passed on down through the ages as a form of oral poetry.
This epic is also famous for perhaps creating the original epic hero. The Gilgamesh of the epic is a superhuman hero, two parts god and one part human. He thus possesses both supernatural powers and human weaknesses, and in many ways it is his human weaknesses that make his so interesting to us. He is the leader of his people and the builder of a great city, and yet he suffers from excessive pride. Constantly, in his search for immortality, he must contend with human limitations. Many scholars believe that he served as the model for other epic heroes from places such as Greece, India and Persia. Thus I have to content that your question cannot be answered except by stating that in many ways this epic defines what an epic is.