Sayyiduna Anas bin Malik (may Allah be pleased with him) said that the Prophet (peace and blessings be upon him) sent Zayd, Ja'far and Abdullah bin Rawahah (may Allah be pleased with them) with an army and made Zayd bin Harithah (may Allah be pleased with him) the commander. All of them were martyred, and the Prophet (peace and blessings be upon him) announced the martyrdom of all three before the news arrived. He said: "Zayd took the banner and was martyred; then Ja'far, and then Abdullah bin Rawahah took the banner, and they were both martyred too. Then one of the swords of Allah, Khalid bin al-Walid, took the banner." He (peace and blessings be upon him) was telling this while tears flowed from his (peace and blessings be upon him) eyes.
This hadith is evidence that one who is fit for leadership can become the deputy, and if he sees that no one else is fit, a man can become the leader even without being appointed, as Sayyiduna Khalid bin al-Walid (may Allah be pleased with him) did.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قتال أهل البغي / 16597