 Altun Tash's tenure as Khwarazm-Shah consisted of preventing the Oghuz and Qarluqs from making raids into the region.He also participated in Mahmud's 1025 campaign against the Karakhanid ruler of Transoxiana, 'Ali-tigin, in which Samarkand was temporarily occupied, and was present at the meeting between Mahmud and his ally, the Karakhanid ruler of Kashgar, Qadir-khan Yusuf.In 1032 Mahmud's successor, Mas'ud struck a new alliance with Qadir-khan Yusuf against 'Ali-tigin, who had recovered his realm shortly after the Ghaznavids had left Transoxiana.