In the late 1170s the Qara Khitai recalled Sultan Shah, who was still living in Ghurid territory. Tekish had become rebellious, refusing to pay tribute and killing Qara Khitai officials. Sultan Shah came out of exile and a Qara Khitai army was sent to reinstate him as Khwarazm Shah. Tekish managed to halt this offensive, however, by opening the dykes of the Amu Darya, flooding the enemy's path.
