Let it be noted of the first generation, as to how the Companions [رضي الله عنهم] hastened after the death of the Messenger of Allah ﷺ to appoint the Imam and contract the pledge of allegiance, and how they believed that it was a conclusive obligation (farḍ), a right and mandated (wājib) with immediacy and urgency, as well as how they left the preparation of the Messenger of Allah ﷺ (for burial) through being busy with it (appointing of the Imam).

They knew that even if a moment was passed over them without an Imam for them, then perhaps a blameworthy incident would afflict them and they would be immersed in a great incident in which opinions were disparate and differed followed by submission to an amalgamation of disparate opinions.

We do not violate the system and invalidate the security, with an imminent collapse through the loosening of the ties of the rulings (aḥkām).

So for this purpose they took the initiative and did not remain still in a situation without one (an Imam).

Thus it is conclusive that the appointing of the Imam is a necessary matter for the preservation of Islam.”

[Imam Ghazali, فضائح الباطنية وفضائل المستظهري Faḍā’iḥ al-Bāṭinīyya wa-Faḍā’il al-Mustaẓhirīyya (The Infamies of the Esotericists and the Virtues of the Mustazhirites),  p. 171 of Arabic text – click here]