The Ghaznavid conquests were initially directed against the Ismaili Fatimids of Multan, who were engaged in an ongoing struggle with the provinces of the Abbasid Caliphate in conjunction with their compatriots of the Fatimid Caliphate in North Africa and the Middle East; Mahmud apparently hoped to curry the favor of the Abbasids in this fashion. However, once this aim was accomplished, he moved onto the richness of the loot of Indian temples and monasteries. By 1027, Mahmud had captured parts of North India and obtained formal recognition of Ghazni's sovereignty from the Abbassid Caliph, al-Qadir Billah.