In the 10th century, the local Ghaznavids turned Ghazni into their capital and firmly established Islam throughout all areas of Afghanistan, except the Kafiristan region in the northeast. Mahmud of Ghazni, a great Ghaznavid sultan, conquered the Multan and Punjab region, and carried raids into the heart of India. Mohammed bin Abdul Jabbar Utbi (Al-Utbi), a historian from the 10th century, wrote that thousands of "Afghans" were in the Ghaznavid army. The Ghaznavid dynasty was replaced by the Ghorids of Ghor in the late 12th century, who reconquered Ghaznavid territory in the name of Islam and ruled it until 1206. The Ghorid army also included ethnic Afghans.