The Sultanate under Iltutmish established cordial diplomatic contact with the Abbasid Caliphate between 1228–29 and had managed to keep India unaffected by the invasions of Genghis Khan and his successors. Following the death of Iltutmish in 1236 a series of weak rulers remained in power and a number of the noblemen gained autonomy over the provinces of the Sultanate. Power shifted hands from Rukn ud din Firuz to Razia Sultana until Ghiyas ud din Balban rose to the throne and successfully repelled both external threats to the Sultanate from the Chagatai Khanate invasions and internal threats from the rebellious sultanate nobles. The Khalji dynasty came into being when Jalal ud din Firuz Khalji overthrew the last of the Slave dynasty rulers, Muiz ud din Qaiqabad, the grandson of Balban, and assumed the throne at Delhi.