Sayyiduna Rafi' al-Ta'i (may Allah be pleased with him), who was the companion of Sayyiduna Abu Bakr (may Allah be pleased with him) in the expedition of Dhat al-Salasil, narrates: I asked Sayyiduna Abu Bakr (may Allah be pleased with him) about what was being said regarding the pledge of allegiance given to him. So he told me about what the Ansar had said, the conversation he had with them, and the talk that Sayyiduna Umar bin al-Khattab (may Allah be pleased with him) had with the Ansar, in which Sayyiduna Umar (may Allah be pleased with him) reminded them of my (Abu Bakr's) leading them in prayer by the order of the Messenger of Allah (peace and blessings be upon him) during the days of his illness. He said: "So for that reason they pledged allegiance to me, and I accepted it from them, because I feared that a trial (fitnah) might break out after which there would be apostasy."
Related hadith on this topic