The ancient core of Samarkand is located on the Afrasiab (Afrosiab) hill, named after the legendary Turanian king. The settlement arose in the 8th - early 7th centuries B.C. and occupied more than 200 hectares. River bluffs on the north and east and deep ravines in the south and west protected it. During the Achaemenids period, the city was encircled with a massive wall having an internal corridor and towers. Scholars identify Afrasiab with the ancient Sogdian capital of Marakanda.
In the middle of the 6th century ВС Sogdiana was part of the Achaemenid (Persian) empire, which existed until the 4th century ВС, when it was destroyed by the armies of Alexander the Great. After putting down the Sogdian revolts which slowed down his campaign for some years, Alexander destroyed Marakanda. Sogdiana was restored to life in the time of the Seleucids.
Until the first half of the 2nd century ВС Sogdiana was part of the Graeco-Bactrian Empire. Later it entered the confederation of Kanguy princedoms. In the first millenium AD Samarkand became one of the strongest princedoms of Sogd, glorified by the achievements of the Sogdians, who organized the caravan trade on the Great Silk Road from the 4th to 8th centuries.
From the 5th to 6th centuries Sogd officially recognized the authority of the Hepthalites, from the 6-7th centuries that of the Turkic khanate and, in the 30s of the 7th century, of the Chinese Tang dynasty.
From the middle of the 7th century the confederation of Sogdian princedoms was headed by the "Ishkhid" (Governor) of Samarkand.
Four lines of new walls were built around Samarkand during that period. Zoroastrian, Buddhist and Christian temples were constructed. Murals in the royal palace survive to this day. In the 8th century, Arabs headed by Quteiba conquered Samarkand.
From the 9th-10th centuries, Samarkand became a cultural center of the Islamic East and the first capital of the Samanids. Ruins of the Samanid palace with carved panels were found in the western sector of Afrasiab.
In the 9th-10th centuries, the inner city occupied 220 hectares. A suburb with markets, mosques, baths and caravansaries adjoined it in the south. The city had a lead water supply system. Manufacturing of Chinese paper was developing. Numerous workshops using water mills sprang up on the banks of the Siab.
In the 11th-13th centuries, Samarkand became the capital of the western Qarakhanid state. It was newly walled. The palace of the Qarakhanids was built in the citadel. The tomb of Kusam ibn Abbas became a holy place where a mausoleum was built.
At the beginning of the 13th century, Khorezmshah took Samarkand and built a new palace in place of the Qarakhanids'. However, the state of the Khorezmshahs was soon conquered by the Mongols. Chinggis Khan took Samarkand after a short siege. The city suffered much due to Chinggisid internal wars in the second half of the 13th century. Afrasiab was finally deserted.