His clear priority is the Islamic Republic’s survival, not the fate of particular Iranian politicians. While Ahmedinejad’s apocalyptic vision makes it difficult for westerners to deal with him, Khamenei does not want to stumble into a military confrontation with the West, which would destabilize Iran and possibly lead to the regime’s downfall.