 There were four main gates to the inner town, each guarded by a "ribat" manned by "ghāzī"s (volunteer fighters for the faith) recruited from Bukhara and Samarkand.The ruler of Sayram apparently also exercised some authority within the steppes, since Moqaddasi mentions that the "king of the Turkmen" at nearby rdū habitually sent presents to Asfījāb.The Qarakhanids seized the city in 980, during the reign of Nuh II of the Samanid Empire.