By the 11th century, Mahmud of Ghazni defeated the remaining Hindu rulers and effectively Islamized the wider region, with the exception of Kafiristan. Mahmud made Ghazni into an important city and patronized intellectuals such as the historian Al-Biruni and the poet Ferdowsi. The Ghaznavid dynasty was overthrown by the Ghurids, whose architectural achievements included the remote Minaret of Jam. The Ghurids controlled Afghanistan for less than a century before being conquered by the Khwarazmian dynasty in 1215.