The area was conquered by the Hephthalites followed by the Saffarids who brought Islam. The Samanids took it and controlled it until the Ghaznavids rose to power in the 10th century, they were replaced by the Ghorids. After the Mongol invasion the Timurids took possession.