The prophet (saws) saw how Islam would spread on earth and the Islamic nations that would be created after his time, He (saws) saw both their rise and fall.
Thawban narrated that the Messenger of Allah (saws) said: “Indeed Allah gathered the earth for me so that I saw its east and its west. And surely my Ummah’s authority shall reach over all that was shown to me of it. And I have been granted the two treasures; the red (Romans) and the white (Persians). I asked my Lord that my Ummah not to be destroyed by a universal drought, and that He does not overcome them by enemies outside of them, reaching to their heart of power (makkah, madina). My Lord said: ‘O Muhammad! When I issue a decree it is not reversed. I have granted for your Ummah that they shall not be destroyed by universal drought. And that they not be overcome by enemies outside of themselves reaching to their heart of power- even if they gather against them from all the regions.”‘ Or he said: “Among the regions. But some of them will destroy others, and some will capture others.”‘ (Tirmidhi, Vol. 4, Book 7, Hadith 2176)
The Prophet said “The affair of this nation will continue to remain upright and it will continue to be victorious over its enemy until it goes through twelve Khaleefahs (rulers), all of whom are from Quraish” (Tribe of the Prophet) The Companions asked, “Then what will happen?” He, said, “Then there will be Faraj (holes and gaps through which seep factors that lead to division and weakness in the ranks and in souls).” (Abu Dawud – Ibn Katheer Bidaya Wa Nihaya)
The Last of these Islamic rulers will be the Mahdi (ra) so they are not the first twelve rulers of Islam. We can ask that if Islam is losing today shouldn’t all the twelve be in the past then, the fact is we are loosing exactly as Allah mentioned “But some of them will destroy others, and some will capture others”, from within ourselves, Islam won’t loose to it’s heart of power in total war until the Last Khalifah comes as all the ahadith indicate, because after Imam Mahdi (ra) it will be the Dajjal (Antichrist) an enemy from outside Islam who will reach to the Umma’s heart of power, marching armies to both Makkah and Madina, before Him (Allah’s curse be upon him) Allah promised this will not occur “And that they not be overcome by enemies outside of themselves reaching to their heart of power”.
The prophet (saws) then described the different dynasties that would come after his time and the forms of government they would use to rule, ending with the Mahdi (ra) himself, one after the other we have seen these come and go and these ahadith alone tell us how much time we have left and where we are along the timeline of events, before Allah takes Islam from the earth.
The messenger of Allah (saws) said the Khalifah of Islam will be followed by kingdoms and then this will eventually end, He (saws) said “Indeed Allah has commenced this matter upon Prophet hood and mercy; it will become Khilaafah and mercy; it will become honor and sanctity; it will become kingdoms, great oppression, and corruption in the nation – people will deem private parts, alcohol, and silk to be lawful. They will be supported upon that and they will be given provision continuously until they meet Allah ‘Azza Wa jall (to Him belongs Might and Majesty).” (Abu Dawud – Ibn Katheer Al Bidaya Wa Nihaya)
The Messenger of Allah said, “The Prophets will be followed by the Khaleefahs, who will apply Allah’s Book and who will be just with Allah’s slaves. The Khaleefahs will be followed by kings, who will take their revenge, kill men, and choose wealth (for themselves). (At that time) one can change (evil) with his hand, with his tongue, and with his heart; and there is no Eemaan beyond that.” (Al Baihaqee – Ibn Katheer Al Bidaya Wa Nihaya)
These Kingdoms came after the first four Khalifah’s of Islam, Abu Bakr, Umar (ra), Uthman (ra) and Ali (ra). They are the Umayyad’s, 7th –8th centuries, the Abbasid’s, 8th –13th centuries, the Fatimid’s, 10th – 12th centuries, the Mamluk’s, 13th –16th centuries, the Safavid’s, 14th – 16th century, the Ottoman’s, 16th -20th century and the Sokoto, 19th century (this list is not conclusive).
He then said after the kingdoms the muslim world will be ruled by tyrants, but when this ends that is when the Mahdi (ra) will appear, the last of the old tyrants in the world today is the one in Syria over which the Civil war is being fought.
The Prophet (saws) said: The Prophethood will remain amongst you for as long as Allah wills it to be. Then Allah will raise it when He wills to raise it (meaning the Prophet will die). Then there will be the Khalifah upon the Prophetic methodology. And it will last for as long as Allah wills it to last. Then Allah will raise it when He wills to raise it. Then there will be biting kingship, and it will remain for as long as Allah wills it to remain. Then Allah will raise it when He wills to raise it. Then there will be tyrannical (forceful) kingship and it will remain for as long as Allaah wills it to remain. Then He will raise it when He wills to raise it. Then there will be a Khalifah upon the Prophetic methodology. Then he (the Prophet) was silent. (Musnad Imam Ahmad (v/273)
The Prophet of Allah said: After me will come caliphs, and after the caliphs will come princes, and after princes there will be kings and after the kings, there will be tyrants. And after the tyrants a man from My House will fill the earth with justice and after him is al-Qahtani (a ruler in the time of Isa, a.s), By the One who sent me with the Truth! Not a word less. (Tabarani, Ibn Mandah, Ibn Asakir and Na‘im bin Hammad)
A scholar said regarding the different dynasties found in these narrations: We see that the caliphs spoken of in this hadith are “the Rightly- Guided Ones”: Abu Bakr, ‘Umar, ‘Uthman and ‘Ali, may Allah the Exalted be pleased with them all. The princes are the Umayyad Caliphs of Damascus and the Abbasid Caliphs of Baghdad. As for the kings, they are the Ottoman Sultans of Istanbul. Following the kings, according to the hadith, are tyrants and that is what is commonly seen today. Finally, what for us is a prediction: the appearance of a man from the family of the Prophet who will rule with justice.
Sa’eed bin Jumhan narrated, “Safinah narrated to me, “The Messenger of Allah (saws) said: “Al-Khalifah will be in my Ummah for thirty years, then there will be monarchy after that.”‘ Then Safinah said to me: ‘Count the Khalifah of Abu Bakr,’ then he said: ‘Count the Khalifah of ‘Umar and the Khalifah of ‘Uthman.’ Then he said to me: ‘Count the Khalifah of ‘Ali.”‘ He said: “So we found that they add up to thirty years.” Sa’eed said: “I said to him: ‘Banu Umaiyyah claim that the Khalifah is among them.’ He said: ‘Banu Az-Zarqa’ lie, rather they are a monarchy, among the worst of monarchies.”‘ (Tirmidhi, Hasan, Vol. 4, Book 7, Hadith 2226).