Ergenekon or Ergeneqon (Turkish: Ergenekon, Mongolian: Эргүнэ хун/Ergüne khun) is a founding myth.
Some researchers claim the myth's Turkic origins, citing similarities between Göktürks and the Ergenekon epic; the first to make the comparison was Joseph de Guignes. However, the relationship is contested.
In the Turkic mythology the myth aims to explain the foundation of the Turkic Khaganate. The Ergenekon legend tells about a great crisis of the ancient Turks. Following a military defeat, the Turks took refuge in the legendary Ergenekon valley where they were trapped for four centuries. They were finally released when a blacksmith created a passage by melting rock, allowing the gray wolf Asena to lead them out. The people led out of the valley found the Turkic Khaganate, in which the valley functions as its capital. A New Year's ceremony commemorates the legendary ancestral escape from Ergenekon. The capital referred to is assumed to be Ordu-Baliq.
In the Mongolian version, Ergenekon was the refuge of the progenitors of the Mongols, Nekuz and Qiyan, as told in the 14th-century literary history Jāmiʿ al-tawārīkh, written by Rashid-al-Din Hamadani. It is a common epic in Mongol mythologies.
Abulghazi Bahadur, khan of the Khanate of Khiva (1643–63), told of the Ergenekon Mongolian creation myth in his work, 17th-century "Shajara-i turk" (Genealogy of the Turks).
In the late Ottoman era, the Ergenekon epic enjoyed use in Turkish literature (especially by the Turkish nationalist movement), describing a mythical Turkic place of origin located in the inaccessible valleys of the Altay Mountains.