The Ortoqid dynasty was an Oghuz Turk dynasty that ruled in the Jezirah (northern Iraq) in the 11th and 12th centuries.
The dynasty was founded by Ortoq, a general originally under Malik Shah I and then under the Seljuk emir of Damascus, Tutush I. Tutush appointed Ortoq governor of Jerusalem in 1086. Ortuq died in 1091, and his sons Sokman and Ilghazi were expelled from Jerusalem by the Fatimid vizier al-Afdal Shahanshah in 1098; the Fatimids lost the city to the crusaders the following year.
Sokman and Ilghazi set themselves up in Diyarbakir, Mardin , and Hisn Kayfa in the Jezirah, where they came into conflict with the sultanate of Great Seljuk. Sokman, lord of Mardin, defeated the crusaders at the Battle of Harran in 1104. Ilghazi succeeded Sokman in Mardin and imposed his control over Aleppo at the request of the qadi Ibn al-Khashshab in 1118. In 1119 Ilghazi defeated the crusader Principality of Antioch at the Battle of Ager Sanguinis.
In 1121 a Seljuk-Ortoqid alliance, commanded by Mehmed I of Great Seljuk and Ilghazi, was defeated by Georgia at the Battle of Didgori. Ilghazi died in 1122, and although his nephew Balak nominally controlled Aleppo, the city was really controlled by Ibn al-Khashshab. Al-Kashshab was assassinated in 1125, and Aleppo fell under the control of Zengi of Mosul. After the death of Balak, the Ortoqids were split between Hisn Kayfa and Mardin. Sokman's son Dawud, lord of Hisn Kayfa, died in 1144, and was succeeded by his son Kara Aslan. Kara Aslan allied with Joscelin II of Edessa against the Zengids, and while Joscelin was away in 1144, Zengi recaptured Edessa, the first of the Crusader states to fall. Hisn Kayfa became a vassal of Zengi as well.
Kara Aslan's son Nur ad-Din Muhammad allied with the Ayyubid sultan Saladin against the Sultan of Rum Kilij Arslan II, whose daughter had married Nur ad-Din Muhammad. In a peace settlement with Kilij Arslan, Saladin gained control of Ortoqid territory, although the Ortoqids were still technically vassals of Mosul, which Saladin did not yet control. With Ortoqid support Saladin eventually took control of Mosul as well.
The Ortoqids still nominally controlled the Jezirah but their power declined under Ayyubid rule.