Yağıbasan

Nizamettin Yağıbasan, or simply Yağıbasan (meaning "enemy raider" or "smashing the enemy") was the sixth ruler of Danishmendids and the uncle of Melik Zünnun.

Background
After Alp Arslan of Seljukids defeated the Byzantine army in the battle of Manzikert in 1071, a series of Turkmen beyliks (principalities) were formed in Anatolia before Anatolia was united by the Sultanate of Rum. Danishmends was one of the most important ones. Following the First Crusade they dominated even on the Seljukids.

Civil war
Yağıbasan was the grandson of Gazi Gümüshtigin and son of Emir Gazi. Emir Gazi died in 1146 in Kayseri. His elder son Zinnun in Kayseri succeeded him. However, he was derecognized by Yağıbasan who was residing in Sivas. After a further partition by a third brother in Malatya, the Danishment power began to decline. Mesut I of the Seljuks saw his chance to end the Danishmend dominance in Anatolia. He captured Sivas and in 1150 Yağıbasan agreed to be a vassal of the Seljuks.

Wars against the Seljuks and the Artukids
In 1155, Mesut died and was succeeded by Kılıç Arslan II. Yağıbasan allied himself with the other Danishmend rulers and attacked Kılıç Arslan to gain the former status of the beylik. But in the battle of Aksaray he was defeated. Nevertheless, soon with the help of the Byzantine Empire, he was able to capture Elbistan from the Seljuks. He continued his campaigns and plundered several forts of the Artukids. By this policy he was caught in between the Seljuks and the Artukids. But, Seljuks of Syria reconciled them.

Death
Yağıbasan died in 1164. He was succeeded by Melik Mucahid Gazi.

Medreses of Yağıbasan
In Tokat, there is a medrese-mosque commissioned by Yağıbasan. The square plan medrese had been constructed in 1151. There is one other medrese also commissioned by Yağıbasan in Niksar.