In 661 CE, after
Ali's death,
Hasan ibn Ali attained to the caliphate. There was a military conflict between Hasan and
Muawiya; and to avoid the agonies of another civil war,
Hasan signed the
Hasan–Muawiya treaty with Muawiyah, according to which Muawiyah wouldn't name a successor during his reign and let the Islamic world choose their successor after the latter.