Ali's reign was plagued by turmoil and internal strife. The Persians, taking advantage of this, infiltrated the two armies and attacked the other army causing chaos and internal hatred between the companions at the Battle of Siffin. The battle lasted several months, resulting in a stalemate. In order to avoid further bloodshed, Ali agreed to negotiate with Mu'awiyah. This caused a faction of approximately 4,000 people, who would come to be known as the Kharijites, to abandon the fight. After defeating the Kharijites at the Battle of Nahrawan, Ali was later assassinated by the Kharijite Ibn Muljam. Ali's son Hasan was elected as the next caliph, but abdicated in favor of Mu'awiyah a few months later to avoid any conflict within the Muslims. Mu'awiyah became the sixth caliph, establishing the Umayyad Dynasty, named after the great-grandfather of Uthman and Mu'awiyah, Umayya ibn Abd Shams.