The Persian Samanids however were defeated by the Turkic Karakhanids who were a confederation of Karluks, Chigils, Yaghmas and other tribes. The Karakhanids were the first Turkic groups to have converted to Islam en masse, and from the 10th to 12th century Taraz was ruled by the Kara-Khanid Khanate as a Muslim state. By the 10th century Taraz had acquired the distinctive features of Central Asian city . Ancient Taraz reached the climax of its development in 11th-12th century under the Karakhanids. Instead of more or less centralized state like the Samanids, Karakhanid Central Asia was divided into many small fiefdoms or appanages. Taraz became an important centre. The political independence of Taraz and autonomy of the circle promoted their development. The power of the city under one of the rulers, Tugan-Khan, was so great that he independently waged a military campaign against Samarkand and temporarily captured it. Kashgar was invaded and it was under the Taraz's power during 15 months. Certainly, this political power was the result of the economic importance of the city. In the Karakhanid Era the main part of Taraz, the Shahristan and Arg, did not grow beyond their sizes in the previous Qarluq-Samanid Era. The Arg lost its main significance in the city's life. The Shahristan became the heart of economic and cultural life of the city. It was there that all the military, administrative, cultural and other establishments that governed life in the medieval feudal city-state took place. At this time in the city and its countryside the mausoleums of Aisha-Bibi and Karakhan were built. Taraz had an underground water system made of terracotta pipes, paved streets, and sewage collection. Of great interest is the Taraz Banya, which was multiple-domed building built from fired brick. In due course under the influence of internecine wars the Karakhanids lost their power and in the end of the 12th century the city was taken by the Kara-Khitans. In 1210 Kara-Khitans were defeated by Khwarazmshah Mohammed.