During the caliphate of Othman, Abdullah b Abi Sarah was the Governor of Egypt. When the opposition to Othman gathered strength, Abdullah b Abi Sarah was overthrown by Muhammad b Hudaifa. Muhammad b Hudaifa was a cousin of Othman. When Hudaifa died, Othman took over the responsibility for the upbringing of Muhammad, and treated him as a son when Muhammad grew up he fell out with Othman and escaped to Egypt where he incited the people to rebel against the authority of Othman. In the confusion following the assassination of Othman, Muhammad b Abi Hudaifa was enticed by Muawiyah to come to Arish on the borders of Palestine where he was murdered treacherously. Muawiyah's attempt to conquer Egypt, however, failed.
On becoming the Caliph, Ali appointed Qais b Sa'ad as the Governor of Egypt. He was a seasoned warrior and enjoyed great fame for his wisdom and diplomacy. He belonged to a distinguished Ansar family of Madina. He was proud of his lineage and was much devoted to Ali. Ali asked him to take with him some troops from Madina. Qais said that the Caliph needed the troops at Madina, and he would not like to weaken the defenses of Madina in any way. Qais left for Madina with a retinue consisting of seven persons only.