… According to some scholars, the most proper meaning of the Hadeeth, “The matter of this nation will continue well-established when they are ruled by twelve caliphs who all belong to Quraysh”,  is that the Prophet (peace and blessings of Allaah be upon him) intends the fourth caliphs, Mu`aawiyah (may Allaah be pleased with them), his son Yazeed , `Abd Al-Malik ibn Marwaan, his four sons and `Umar ibn `Abd Al-`Azeez. These are twelve caliphs.

What I want to assure is that the strongest and soundest view concerning the twelve ‘A’ immah is that they end with Hishaam ibn `Abd Al-Malik as religion in their time was established, Islaam was prevailing, the truth was apparent and Jihaad was in force.

As for what happened after the death of Yazeed of difference and disunity in the caliphate so that Marwaan ruled the Levant (the region covering Syria, Lebanon, Jordan, and Palestine) and Ibn Al-Zubayr ruled Al-Hijaaz all of this did not harm Muslims in their religion for their religion was predominant and widespread and their enemy was subjugated in spite of the dispute that happened then it ended by paying the pledge of allegiance to `Abd Al-Malik and people became united in spite of the trouble that happened at the hands of Al-Hajjaaj and others …

Source: Fataawaa Ibn Baaz, alifta.net