In the 7th century AD, the Muslim conquests of the Ancient Near East meant that Kurdistan became part of the Rashidun Empire. The Kurdish tribes ("social groups") in Upper Mesopotamia and the western Iranian plateau fought against the attacking armies for a time. Most Kurds became part of the Shafi`ite division of Islam. In the three centuries after this, some Kurds gained some autonomy ("self-rule") for their culture and politics, in the time of the Umayyad Caliphate and the following Abbasid Caliphate.