Allah had promised to those among you who believe and do good works that He will surely make them Successors in the earth, as He made Successors from among those who were before them; and that He will surely establish for them their religion which He has chosen for them; and that He will surely give them in exchange security and peace after their fear: They will worship Me, and they will not associate anything with Me. Then whoso is ungrateful after that, they will be the rebellious. (Surah Al-Nur, Verse 56).
God Almighty does everything through wisdom and foresight, and there is always a good reason and logic behind it. According to nature’s physical laws, man has only a limited life span, but the task of reformation and training of society requires a much longer time. So, Allah has established the system of Khilafat after the system of Prophethood. The Khalifah continues and carries on the task of the Prophet. The seed sown by the Prophet is protected and nurtured by the Khalifah till it becomes a strong and sturdy tree. It shows that in fact Khilafat is an offshoot or branch of the system of Prophethood, that is why the Holy Prophet sa says that after every Prophet, the system of Khilafat is established. (taken from Welcome to Ahmadiyyat).