Seljuq dynasty
One of the earliest mentions of the city comes from the Arab geographer Al-Muqaddasi, who described it in the 10th century as "a large city surrounded by seven walls, mosque located in the inner city." In 1065, the city submitted to the Seljuq dynasty, which was part of the transformation of the Kara-Khanid Khanate into a vassal of the Seljuqs.