 In 997, after Fakhr al-Daula died, Ibrahim b. Marzuban b. Isma'il took advantage of the weakness of his successor to seize control of Shamiran, Zanjan, Abhar, and Suharavard.When the Ghaznavid Mahmud of Ghazni conquered Ray in 1029 he sent a force to conquer Ibrahim's territories, but it failed to do so.Ibrahim took Qazvin from the Ghaznavids and defeated Mahmud's son Mas'ud in battle.