 In around 1097 Qutb al-Din Muhammad was appointed governor of Khwarazm by the Seljuk sultan Barkiyaruq's military commander, Habashi ibn Altun-Taq.Habashi had just put down a revolt by two Seljuk amirs, Qodun and Yaruq-Tash, who had killed the previous governor of Khwarazm, Ekinchi, and wanted to rule the province themselves.Qutb al-Din Muhammad therefore took control of Khwarazm and stopped an attempt by Ekinchi's son, Toghril-Tegin, to take control of the region.