Ghuri, a dynasty that had struggles with Mahmud of Ghazni, and after their own defeat by the Mongols held Herat on sufferance.