Islamic history of Yemen

Islam came to Yemen around 630 during Muhammad's lifetime and the rule of the Persian governor Badhan. Thereafter, Yemen was ruled as part of Arab-Islamic caliphates, and became a province in the Islamic empire.

Regimes affiliated to the Egyptian Fatimid caliphs occupied much of northern and southern Yemen throughout the 11th century, including the Sulayhids and Zurayids, but the country was rarely unified for any long period of time. Local control in the Middle Ages was exerted by a succession of families which included the Ziyadids (818–1018), the Najahids (1022–1158), the Egyptian Ayyubids (1174–1229) and the Turkoman Rasulids (1229–1454). The most long-lived, and for the future most important polity, was founded in 897 by Yayha bin Husayn bin Qasim ar-Rassi. They were the Zaydis of Sa'dah in the highlands of North Yemen, headed by imams of various Sayyid lineages. As ruling Imams of Yemen, they established a Shia theocratic political structure that survived with some intervals until 1962.

After the introduction of coffee in the 16th century the town of al-Mukha (Mocha), on the Red Sea coast, became the most important coffee port in the world. For a period after 1517, and again in the 19th century, Yemen was a nominal part of the Ottoman Empire, although on both occasions the Zaydi Imams contested the power of the Turks and eventually expelled them.

Final years of pre-Islamic Yemen and arrival of Islam
In the final pre-Islamic period, the Yemeni lands included the large tribal confederations Himyar, Hamdan, Madh'hij, Kindah, Hashid, Bakil, and Azd.

During the 6th century, Yemen was involved in the power struggles between the Christian Byzantine Empire and the Zoroastrian Sasanian Empire. Following persecutions of Christians by the Jewish Himyarites, in 525 the Christian Aksumite Empire, a Byzantine ally, occupied Yemen. In turn, local tribal leaders turned to the Sasanians for aid. The latter took over the region in 575 and converted it into a province of the Sasanian Empire. The descendants of these Persian soldiers, known in Arabic as al-Abna', dominated the capital, Sana'a, but the rest of the country in practice remained divided among a multitude of autonomous local rulers and tribal chiefs. After the dissolution of Persian rule in South Arabia, the al-Abna' turned to the emerging Islamic state under Muhammad in order to find support against local Arab rebels.

The last Persian governor, Badhan, converted to Islam on 6 AH (628 CE), thus nominally submitting the entirety of Yemen to the new faith. The actual extent of conversion in the country is not known, and the scarcity and lack of detail in the primary sources is exacerbated by the retroactive attempts, in later accounts, by each group to provide an early conversion date for itself for reasons of prestige. In practice, the land remained much like it had been in pre-Islamic times, and the new religion became another factor in the internal conflicts that afflicted Yemeni society since old. Towards the end of Muhammad's life, in 632, a certain al-Aswad al-Ansi proclaimed himself prophet and found widespread support among the Yemenis, although the exact motivation of his uprising is unclear. He captured Sana'a, but was killed by the al-Abna' and defecting members of his own faction in the same year.

Rashidun era (632–661)
After Muhammad's death, Wars of Apostasy broke out across the Arabian Peninsula. The first Rashidun caliph, Abu Bakr ((r. 632 – 634)), sent troops from Medina into Yemen, and levied local forces to augment them. This allowed Muslim rule to survive the conflict there. Many of the apostate leaders were pardoned and went on to play important roles in the early Muslim conquests.

Under the Rashidun caliphs, the first governors were sent to administer Yemen for the nascent Islamic empire. The known lists of governors are often unclear and contradictory, but represent almost the only information about the early history of Islamic Yemen. Governors are mentioned for the entirety of Yemeni territory, but also individually for Sana'a, al-Janad (based at Taiz), and Hadramawt. The governors of Sana'a appear to have at times exercised some control over the others, but even so their authority was often limited to the cities they were based in, and most of the country remained outside effective control. The early governors were usually chosen from senior Companions of Muhammad. The last of them, Ya'la ibn Umayya, served for twenty years and was only dismissed by the fourth Rashidun caliph, Ali ((r. 656 – 661)).

The Rashidun caliphs themselves also paid some attention to the affairs of Yemen, especially the spread of Islam. Judges and Qur'an instructors were appointed, and the Christian tribes of Najran evicted under Caliph Umar ((r. 634 – 644)), despite prior treaties with Muhammad and Abu Bakr guaranteeing their status. The Jewish population was allowed to remain, in exchange for the payment of the jizya (poll tax).

The main events of the First Muslim Civil War (656–661) took place far from Yemen, but the country was nevertheless deeply affected. Yemenis were divided between the rival camps of Ali and Mu'awiya I ((r. 661 – 680)), and both sides sent their own troops into the country. Ali's partisans initially prevailed, but one of Mu'awiya's generals captured Najran and Sana'a for his master in 660.

Umayyad era (661–750)
The Umayyad Caliphate, founded by Mu'awiya, shifted their base from the Arabian Peninsula to Syria, but continued to pay great attention to Yemen. Governors were appointed directly by the caliph. During some periods, Yemen was administratively grouped together with Hijaz and Yamama. Still, the caliphal governors' actual control barely extended to the wider country, where the pre-Islamic elites still retained their position.

During most of the Second Muslim Civil War (683–692), Yemen was nominally under the control of the Mecca-based anti-caliph, Abdallah ibn al-Zubayr. However, his control over the country was tenuous, judging from the frequent alternation of governors during his rule. Ibn al-Zubayr's tenuous authority was not enough to protect Sana'a against the threat of the Kharijites of Oman and Bahrayn: in 686, the city had to bribe the Kharijites not to attack, and in the next year, its inhabitants were forced to swear allegiance to the Kharijite leader, Najda ibn Amir. Following the victory of the Marwanid branch of the Umayyads in the civil war, Sana'a surrendered to an Umayyad army without resistance.

The Marwanid caliphs made considerable investments in the country's infrastructure, leading to an upsurge in prosperity. As elsewhere in the Muslim world, Caliph Umar ibn Abd al-Aziz ((r. 717 – 720)) gained a reputation for justice that carried over even into the local Shi'a traditions.

In spite of the tenuous caliphal authority, the Yemenis seldom rebelled against the Umayyads. A certain Abbad al-Ru'yani revolted in 725/6, but his motivation is unclear: according to some sources, he was a Himyarite self-proclaimed messiah, while others consider him a Kharijite. The most serious revolt occurred at the end of the period, in 746–748, as Umayyad power was weakened during the Third Muslim Civil War. It was headed by a Kindi tribesman, Abdallah ibn Yahya, who assumed the honorific title of Talib al-Haqq, and proclaimed himself caliph in the Hadramawt. With support from the Ibadi Kharijites of neighbouring Oman, he advanced onto Sana'a. His army occupied Mecca and Medina, and even Basra for a while swore allegiance to him, before his uprising, as well as other tribal revolts of the Himyarites, were suppressed by the Umayyad general Abd al-Malik ibn Atiyya. However, the Ibadis of Hadramawt on that occasion obtained from Ibn al-Atiyya the right to choose their own governors, a privilege they kept for about a generation.

Abbasid era (750–847)
The Third Muslim Civil War fatally weakened the Umayyad regime, culminating in the Abbasid Revolution, and the overthrow of the Umayyad Caliphate by the Abbasid Caliphate in 749–750.

The Abbasids continued the policy of the Umayyads with respect to Yemen. Frequently, members of the highest Abbasid aristocracy, including princes of the dynasty, served as governors. At other times, the province was attached to the Hijaz, whose governor sent a deputy to rule Yemen in his stead. In 759, the Abbasid governor, a native Yemeni named Abdallah ibn Abd al-Madan, tried to secede from the Caliphate. His revolt was suppressed by the Abbasid general Ma'n ibn Za'ida al-Shaybani, who went on to serve as governor of Yemen until 768. During his tenure, he brutally suppressed uprisings—mainly Ibadi-inspired—across the country, restoring a measure of peace and order.

Under Caliph Harun al-Rashid ((r. 786 – 809), Muhammad ibn Khalid ibn Barmak, one of the famous Barmakids, was governor of Yemen. His time is recorded as one of prosperity for the capital Sana'a, but also of widespread poverty. In 800, the Himyarite chieftain al-Haysam ibn Abd al-Samad rose in revolt, but was defeated by Harun's governor Hammad al-Barbari. Hammad was successful in restoring peace to the region and securing the trade routes, but his harshness towards the local population led to his recall in 810.

During the civil war in 811–813 between Harun's sons, al-Amin and al-Ma'mun, Yemen initially belonged to al-Amin's camp, but one of al-Ma'mun's agents, Yazid ibn Jarir, managed to win the country over for his master. In 815, the Alid Ibrahim ibn Musa al-Kazim, son of the Twelver imam Musa al-Kazim, occupied Sana'a and the northern highlands and struck coins in his own name. He may even have briefly captured Mecca, but was defeated by Abbasid forces near Sana'a in the same year. Nevertheless, after the caliph had reached an understanding with the Alids and appointed Ibrahim's brother, Ali al-Ridha, as his heir-apparent, the same Ibrahim was appointed governor of Mecca and Yemen in 820. This resulted in a revolt by the incumbent governor, Hamdawayh, who had to be subdued by yet another expedition. Ibrahim remained as governor of Yemen until 828.

Direct Abbasid authority in Yemen survived until 847, when the autonomous Yu'firid dynasty defeated the Abbasid governor, Himyar ibn al-Harith, and captured Sana'a. Already during al-Ma'mun's time, however, local tribal or sectarian leaders began to rise and unite hitherto fragmented parts of the country under their authority, a process that would continue during the entire 9th century.

Yemeni textiles, long recognized for their fine quality, maintained their reputation and were exported for use by the Abbasid elite, including the caliphs themselves. The products of Sana'a and Aden have been particularly important in the east–west textile trade.

Collapse of Abbasid authority and rise of native dynasties
The first local dynasty to emerge in Yemen during the 9th century were the Ziyadids. The dynasty was established by Muhammad ibn Abdallah ibn Ziyad, a descendant of a cadet branch of the Umayyad dynasty, who was appointed by al-Ma'mun in 817 to suppress revolts in the western coastal plain of the Tihama. In 819, Ibn Ziyad founded Zabid as his capital. At the height of the dynasty, its power extended along the coasts to Aden in the south and Mirbat in the west, and Zabid was so prosperous as to be known as 'Baghdad of the Yemen'. Unlike the rest of the country, where Shi'a sympathies were strong, the Tihama was solidly pro-Sunni, and the Ziyadid dynasty remained aligned with the Sunni Abbasids against the Shi'a regimes that arose during the late 9th century.

Unlike the Ziyadids, who at least in the beginning ruled with the sanction of the Abbasids, in other parts of Yemen, local dynasties arose in opposition to Abbasid rule. In the south, the Himyarite Manakhi dynasty took control of the southern highlands in 829. At the same time, in the central highlands the Himyarite Yu'firid dynasty took power, based at Shibam, northwest of Sana'a. After twenty years of warfare its founder, Yu'fir ibn Abd al-Rahman al-Hiwali, captured Sana'a in 847. In the following years, their power extended into the northern highlands, to the south up to Janad, and east into Hadramawt. As Sunnis, their rule was recognized by the Abbasids in 870, although in practice the Yu'firids were often tributary to their Ziyadid neighbours. Ziyadid power collapsed rapidly after 882, when the murder of Yu'fir's two sons in the mosque of Shibam provoked widespread rebellions against their rule. The Abbasids sent Ali ibn al-Husayn as governor, and his tenure in 892–895 managed to stabilise the situation around Sana'a.

Rise of sectarian regimes
By the 890s, Yemen was politically divided between the three major local dynasties, the Ziyadids, and Yu'firids, and Manakhis, as well as a host of constantly quarreling minor tribal leaders, especially in the north. The lack of political unity, the remoteness of the province from the Abbasid imperial centre, and its inaccessible terrain, along with deep-rooted Shi'a sympathies in the local population, made Yemen, in the words of historian A. B. D. R. Eagle, "manifestly fertile territory for any charismatic leader equipped with tenacity and political acumen to realise his ambitions". This occurred at the end of the 9th century with the arrival of agents of two rival Shi'a sects, the Zaydis and the Isma'ilis. The prolonged crisis of the Abbasid Caliphate from the mid-9th century on, widespread millennialist expectations, and dissatisfaction among many adherents of the more mainstream Imamite Shi'a over the quietism of their leadership and the apparent end of the line of imams, enhanced the appeal of the more radical Shi'a sects across the Muslim world.

Early Isma'ili activities and rule over Yemen (881–917)
Isma'ili activity in Yemen is first recorded around the mid-9th century, in the southern highlands around Mudhaykhirah, the Manakhi capital. It was led by a certain al-Hadan ibn Faraj al-Sanadiqi, but the few details that are known derive from later sources. According to the historian Ella Landau-Tasseron, they record simply that he "pretended to be a prophet, committed many atrocities, and was the cause of a massive emigration".

Far better known are the careers of the two Isma'ili missionaries (da'is), the Kufan Ibn Hawshab, and the native Yemeni Ali ibn al-Fadl al-Jayshani, later in the century. Their missionary activity (da'wa) in Yemen began in 881, among the mountain tribes. Ibn Hawshab targeted the central highlands near Sana'a, while al-Jayshani made Janad his base.

The Isma'ili movement quickly expanded over much of the country; Sana'a was captured in 905. Yemen also served as a major centre for the broader Isma'ili da'wa, with Ibn Hawshab sending missionaries to Oman, the Yamama and even Sindh. Most notable among these missionaries was Abu Abdallah al-Shi'i, a native of Sana'a. On Ibn Hawshab's instructions, in 893 he left for the Maghreb, where he began proselytizing among the Kutama Berbers. His mission was extremely successful. Backed by the Kutama, in 903 he was able to rise in revolt against the Aghlabid emirs of Ifriqiya, culminating in their overthrow and the establishment of the Isma'ili Fatimid Caliphate in 909.

Meanwhile, in Yemen, the Isma'ilis engaged in a series of back-and-forth contests with the Yu'firids and the newly established Zaydi imamate over control of Sana'a, but Ibn al-Fadl emerged victorious in 911. At that point, just as Isma'ilism was triumphant in Yemen and the Fatimid Caliphate had just been established under the supposed mahdi, Abdallah al-Mahdi, Ibn al-Fadl broke with the Isma'ili cause and his colleague, Ibn Hawshab, and claimed to be the mahdi himself. Following the death of both Isma'ili leaders in 914–915, their regimes collapsed amidst internal squabbles and Yu'firid attacks. The Yu'firid ruler As'ad ibn Abi Ya'fur, a former vassal of Ibn al-Fadl, captured Mudhaykhirah in 917, and the Isma'ili movement in Yemen returned to being a secretive, underground affair for over a century, until the rise of the Sulayhid dynasty.

First Zaydi imamate in Sa'ada (897–1058)
While the two Isma'ili da'is extended their influence, another Shi'a leader arrived in Yemen: Yahya, a representative of the Zaydi sect. In Zaydi doctrine, as in Isma'ilism, the imam has to be a descendant of Fatimah and Ali, but the position is not hereditary or by appointment (nass), unlike in the Twelver and Isma'ili traditions of Shi'a Islam. Instead, it can be claimed by any qualified Fatimid who fulfills a number (usually 14) of stringent conditions (religious learning, piety, bravery, etc.), by 'rising' (khuruj) and 'calling' (da'wa) for the allegiance of the faithful. Zaydi doctrine emphasized that the imamate was not contingent on popular acclaim or election; the very act of da'wa denoted God's choice. On the other hand, if a more excellent candidate appeared, the incumbent imam was obliged to acknowledge him.

Previous Zaydi uprisings against the Abbasids in Iraq and the Hijaz—the heartlands of the Islamic world—had failed, but had been successful in the Caliphate's peripheral areas: Idris ibn Abdallah, a great-greta-grandson of Ali, had founded a Zaydi state in what is now Morocco, while a distant relative of Yahya's, Hasan ibn Zayd, had founded a Zaydi state in Tabaristan, a mountainous region on the southern shores of the Caspian Sea. Yahya himself spent some time in Tabaristan, before being invited to Yemen in 893/4 to settle tribal disputes in the north of the country. This first sojourn failed, and he had left, but in 897 he returned and quickly established a state based in Sa'ada, in the northern highlands, with himself as imam with the title al-Hadi ila'l-Haqq. Given the continued presence and importance of the Zaydi imamate in the subsequent Yemeni history, up to the dissolution of the Zaydi kingdom in 1962, this marks one of the most important turning points in Yemeni history.

Until Yahya's death in 911, the nascent Zaydi imamate fought with the Yu'firids and the Isma'ilis over control over Sana'a. His death left the new Zaydi regime adrift. As Landau-Tasseron notes, the Zaydi imamate was not a state as such, as "there was no formal administrative apparatus and no fixed pattern of succession". Anyone of Alid descent could lay claim to the imamate, as long as he engaged in military activity to promote the Zaydi cause. This meant that the line of imams was often interrupted by interregna when there was no imam, or conversely that multiple candidates for the imamate appeared at the same time. At the same time, the obligation to promote Zaydism by force meant that the imams were in constant conflict with non-Zaydis, as well as with their own followers when they refused to obey imam's authority; not even taking into account that the Zaydi imams in Yemen, being reliant on tribal backing, were themselves drawn into pre-existing tribal conflicts.

Nevertheless, the first Zaydi imamate founded by Yahya and his successors of the Rassid dynasty survived in its core territories of Sa'ada and Najran until 1058, when, weakened by internal conflicts and sectarian disputes, the Sulayhid dynasty destroyed it.

Dynasties of the 11th–12th centuries
The death of the Isma'ili and Zaydi leaders in short succession allowed for a brief resurgence of Yu'firid power in and around Sana'a, but this did not outlast As'ad ibn Abi Ya'fur's death in 955. Weakened by internal quarrels, the Yu'firid dynasty ended in 997 with the death of the last ruler, Abdallah ibn Qahtan Abdallah, at Ibb. At the same time, the Ziyadid dynasty also declined, although little information survives as to why: the last rulers of the dynasty are obscure, and after 981 and until the dynasty's ostensible end in 1018, not even their names are known.

Najahids (1022–1156)
The Ziyadids were replaced in the Tihama lowlands by the Najahid dynasty, established in 1022 by two Black African slave brothers, Najah and Nafis. Najah quickly sidelined his brother, and secured recognition from the Abbasid caliph. However, their territory was smaller than that of the Ziyadids, being limited to the Tihama, and their history was rather chequered. In 1060, the highland Sulayhid dynasty conquered their lands for twenty years, and it was only after a prolonged struggle that in 1089 that a new Najahid ruler, Jayyash, established his power firmly over Zabid and its territory. Jayyash founded the city of Hais, which he settled with his kinsfolk from Abyssinia.

Sulaymanids (c. 1069–1173)
In the late 12th century, another regional dynasty arose in the northern Tihama, the Sulaymanids. These were an otherwise obscure family of Hasanid Alid descent, who took power in Harad around 1069 (the date is hypothetical), and likely served as vassals of the Najahids.

Mahdids (1156–1173)
After the death of Jayyash, power was held by a series of slave (mamluk) viziers who served in the Najahid ruler's name until 1156, when the Mahdid dynasty replaced them. The Mahdid dynasty was founded by the religious preacher Ali ibn Mahdi, who claimed descent from the Himyarite kings. Although he enjoyed the favour of the Najahid queen Alam al-Malika, after her death in 1150 he began a series of attacks on Zabid. These failed, but his intrigues with the Najahid viziers bore fruit: by 1159, Zabid was in his hands, but he died shortly thereafter. His son and successor, Abd al-Nabi, is portrayed in most historical sources as a dissolute, ambitious, and evil ruler, who aimed to conquer the world. Indeed, he launched frequent and brutal raids against all his neighbours, killing the Sulaymanid ruler in 1164, capturing Taiz and Ibb in 1165, and beginning a seven-year-long siege of Aden that was only broken in 1173, when the Zurayids and Hamdanids allied against him. Shortly after, the Ayyubid prince Turan-Shah entered Yemen, invited by the Sulaymanids, and began its conquest by capturing Zabid and ending the Mahdid state.

Sulayhids (1047–1137)
Unlike many of the other dynasties to rule over Yemen in the 10th–11th centuries, the Sulayhids were native Yemenis. The founder of the regime was Ali ibn Muhammad al-Sulayhi, born in the Haraz district west of Sana'a. He became an Isma'ili da'i, operating at first secretly, and eventually publicly, establishing his base on Mount Masar. From there he pushed back the Zaydis, and defeated the rulers of Sana'a and Hadur, took over the Tihama after poisoning its Najahid ruler, and finally subjugated Aden and the Hadramawt. By 1063, al-Sulayhi had reunified most of Yemen under his rule, and made Sana'a his capital. As an Isma'ili, al-Sulayhi formally ruled in the name of the Fatimid caliphs in Cairo, and also intervened on their behalf in the Hijaz, including Mecca.

He was murdered by the Najahids in 1067, but his mission was continued by his son al-Mukarram. Like his father, al-Mukarram had to engage in constant fights with the Najahids and Zaydis, as well as tribal revolts. He was successful in this, until illness forced him to hand over the affairs of government to his wife, Arwa al-Sulayhi, before his death in 1094. Under Arwa, the dynasty moved its seat to Dhu Jibla. In the schism of the Isma'ili movement between Musta'lis and Nizaris, which occurred in 1094 over the succession to the caliph al-Mustansir, she sided with the former and was designated chief da'i, although she was forced to use male agents sent from Cairo in the field. Her reign also marked the start of Sulayhid decline, with defeats against the Zaydis and Najahids already in 1087, and Sana'a lost to the Hamdanids. In 1130, another succession crisis in Cairo caused yet another rift, between Hafizis and Tayyibis; breaking with the Fatimid regime, Arwa sided with the latter. This deprived her of Cairo's support and weakened Sulayhid authority.

Zurayids (1083–1173)
Arwa's death in 1137, the Sulayhid state collapsed, being replaced by the Zurayids, a regional dynasty that had ruled Aden since 1083 under Sulayhid overlordship. Al-Abbas and al-Mas'ūd, sons of Karam Al-Yami from the Hamdan tribe, started ruling Aden on behalf of the Sulayhids. When Al-Abbas died in 1083, his son Zuray, who gave the dynasty its name, proceeded to rule together with his uncle al-Mas'ūd. They took part in the Sulayhid leader al-Mufaddal's campaign against the Najahid capital Zabid and were both killed during the siege (1110). Their respective sons ceased to pay tribute to the Sulayhid queen Arwa al-Sulayhi. They were worsted by a Sulayhid expedition but queen Arwa agreed to reduce the tribute by half, to 50,000 dinars per year. The Zurayids again failed to pay and were once again forced to yield to the might of the Sulayhids, but this time the annual tribute from the incomes of Aden was reduced to 25,000. Later on they ceased to pay even that since Sulayhid power was on the wane. After 1110 the Zurayids thus led a more than 60 years long independent rule in the city, bolstered by the international trade. The chronicles mention luxury goods such as textiles, perfume and porcelain, coming from places like North Africa, Egypt, Iraq, Oman, Kirman and China. After the demise of queen Arwa al-Sulayhi in 1138, the Fatimids in Cairo kept a representation in Aden, adding further prestige to the Zurayids. The Zurayids were sacked by the Ayyubids in 1174 AD. They were a Shia Ismaili dynasty that followed the Fatimid Caliphs based in Egypt. They were also Hafizi Ismaili as opposed to the Taiyabi Ismaili.

Hamdanids (1099–1173)
The Yemeni Hamdanids were a series of three families descended from the Arab Banū Hamdān tribe, who ruled in northern Yemen between 1099 and 1174. They must not be confused with the Hamdanids who ruled in al-Jazira and northern Syria in 906–1004. They were expelled from power when the Ayyubids conquered Yemen in 1174. They were a Shia Ismaili dynasty that followed the Fatimid Caliphs based in Egypt. They were also Hafizi Ismaili as opposed to the Taiyabi Ismaili.

Ayyubid era (1174–1229)
The importance of Yemen as a station in the trade between Egypt and the Indian Ocean area, and its strategical value, motivated the Ayyubid invasion in 1174. The Ayyubid forces were led by Turanshah, a brother of Sultan Saladin. The enterprise was entirely successful: the various local Yemeni dynasties, mainly the Zurayids were defeated or submitted, thus bringing an end to the fragmented political landscape. The efficient military might of the Ayyubids meant that they were not seriously threatened by local regimes during 55 years in power. The only disturbing element was the Zaydi imam who was active for part of the period. After 1217 the imamate was split, however. Members of the Ayyubid Dynasty were appointed to rule Yemen up to 1229, but they were often absent from the country, a factor that finally led to them being superseded by the following regime, the Rasulids. On the positive side, the Ayyubids united the bulk of Yemen in a way that had hardly been achieved before. The system of fiefs used in the Ayyubid core area was introduced to Yemen. The policies of the Ayyubids led to a bipartition that has lasted ever since: the coast and southern highlands dominated by Sunni and adhering to the Shafi'i school of law; and the upper highlands with a population mainly adhering to the Zaydiyyah. Ayyubid rule was therefore an important stepping-stone for the next dynastic regime.

Rasulid era (1229–1454)
The Rasulid dynasty, or Bani Rasul, were soldiers of Turkoman origins who served the Ayyubids. When the last Ayyubid ruler left Yemen in 1229 he appointed a member of Bani Rasul, Nur ad-Din Umar, as his deputy. He was later able to secure an independent position in Yemen and was recognized as sultan in his own right by the Abbasid Caliph in 1235. He and his descendants drew their methods of governance from the structures set up by the Ayyubids. Their capitals were Zabid and Ta'izz. For the first time, most of Yemen became a strong and independent political, economic, and cultural unit. The state was even able to contend with the Ayyubids and later the Mamluks over influence in Hijaz. The south Arabian coast was subdued in 1278–79. The Rasulids in fact created the strongest Yemeni state during the medieval Islamic era. Among the numerous medieval polities it was the one that endured for the longest period, and enjoyed the widest influence. Its impact in terms of administration and culture was stronger than the preceding regimes, and the interests of the Rasulid rulers covered all the affairs prevalent in those times.

Some of the sultans had strong scientific interests and were skilled in astrology, medicine, agriculture, linguistics, legislation, etc. They built mosques, houses and citadels, roads and water channels. Rasulid projects extended as far as Mecca. The Sunnization of the land was intensified and madrasas were built everywhere. The flourishing trade gave the sultans great incomes which bolstered their regime. In the highlands the Zaydiyyah were initially pushed back by the Rasulid might. Nevertheless, after the late 13th century a succession of imams were able to build up a strong position and expand their influence. As for the Rasulid regime it was upheld by a long series of very gifted sultans. However, the polity began to decline in the 14th century, and especially after 1424. From 1442 to 1454 a number of rival claimants competed for the throne, which led to the downfall of the dynasty in the latter year.

Tahirids (1454–1517)
The Bani Tahir was a powerful native Yemeni family which took advantage of the weakness of the Rasulids and finally gained power in 1454 as the Tahirids. In many respects the new regime tried to imitate the Bani Rasul whose institutions they took over. Thus they built schools, mosques and irrigation channels as well as water cisterns and bridges in Zabid, Aden, Yafrus, Rada, Juban, etc. Politically the Tahirids did not have ambitions to expand beyond Yemen itself. The sultans fought the Zaydi imams for periods, with varying success. They were never able to occupy the highlands entirely. The Mamluk regime in Egypt began to dispatch seaborne expeditions towards the south after 1507, since the presence of the Portuguese constituted a threat in the southern Red Sea region. At first the Tahirid sultan Amir II supported the Mamluks, but later refused to assist them. As a consequence he was attacked and killed by a Mamluk force in 1517. Tahirid resistance leaders continued to disturb the Mamluk occupiers until 1538. As it turned out, the Tahirids were the last Sunni dynasty to rule in Yemen.

First Ottoman period (1538–1635)
Now, the coast and southern highlands were suddenly left without a central government for the first time in almost 350 years. Shortly after the Mamluk conquest in 1517, Egypt itself was conquered by the Ottoman sultan Selim I. The Egyptian garrison in Yemen was cornered in a minor part of the Tihama, and the Zaydi imam expanded his territory. The Mamluk militaries formally recognized the Ottomans until 1538, when regular Turkish forces arrived. At this time the Ottomans began to worry about the Portuguese who occupied Socotra Island. The Ottomans eliminated the last Tahirid lord in Aden and the Mamluk military leadership, and set up an administration based in Zabid. Yemen was made a province (Beylerbeylik). The Portuguese blockade of the Red Sea was broken. A number of campaigns against the Zaydis were fought in 1539–56, and Sana'a was taken in 1547. Turkish misrule led to a large rebellion in 1568. The Zaydi imam put up a stubborn fight against the invaders who were almost expelled from Yemeni soil. Resistance was overcome in a new campaign in 1569–1571. After the death of imam al-Mutahhar in 1572, the highlands were occupied by the Turkish troops. The first Turkish occupation lasted until 1635. The new lords promoted Sufis and Ismailis as a counterweight to the Zaydiyyah. However, Yemen was too far removed to be managed efficaciously. Over-taxation and unjust and cruel practices caused deep popular antipathy against foreign rule. The Zaydis accused the Ottomans of being "infidels of interpretation" and appointed a new imam in 1597, al-Mansur al-Qasim. In accordance with the doctrine that an imam must make a summons to allegiance (da'wa) and rebel against illegitimate rulers, Imam al-Mansur and his successor expanded their territory at the expense of the Turks who eventually had to leave their last possessions in 1635.

Qasimids (1597–1872)
The imam al-Mansur al-Qasim (r. 1597–1620) belonged to one of the branches of the Rassid (descendants of the first imam or his close family). The new line became known as the Qasimids after its founder. Al-Mansur's son al-Mu'ayyad Muhammad (r. 1620–1644) managed to gather Yemen under his authority, expel the Turks, and established an independent political entity. His successor al-Mutawakkil Isma'il (r. 1644–1676) subdued Hadramawt and entertained diplomatic contacts with the negus of Ethiopia and the Mughal emperor Aurangzib. He also reinstated the common annual pilgrimage caravans to Mecca, trying to inspire a sense of unity between Sunni and Shi'a Muslims. For a time, the imams ruled a comprehensive territory, from Asir in the north to Aden in the south, and to Dhofar in the far east. The centre of the imamic state was San'a, although the imams also used other places of residence such as ash-Shahara and al-Mawahib. Its economic base was strengthened by the coffee trade of the coastal entrepot Mocha. Coffee had been introduced from Ethiopia in about 1543, and Yemen held a monopoly on this product for a long time. Merchants from Gujarat frequented Yemen after the withdrawal of the Turks, and European traders established factories after 1618. The first five imams ruled from strict Zaydi precepts, but unlike in the previous practice the Qasimids in fact succeeded each other as in a hereditary dynasty. Their state became institutionalized by the time, since Ottoman-style administration was applied, a standing army was kept, and a chief judge appointed. Most of the provinces were governed by members of the Qasimid family. Provincial rulers performed bay'ah (ritual homage) at their accession, but their fiefs became increasingly autonomous by the time.

The power of the imamate declined in the 18th and 19th century for a number of reasons. Politically it was never entirely stable since clashes between Qasimid branches occurred with some frequency and succession to the imamate was often contested. Adding to this, theological differences surfaced in the 18th century, since the Qasimids practiced ijtihad (legal reinterpretations) and were accused of illicit innovations (bidah). Tribal risings were common and the territory controlled by the imams shrank successively after the late 17th century. The Yafa tribe of South Yemen fell away in 1681 and Aden broke loose in 1731. The lucrative coffee trade declined in the 18th century with new producers in other parts of the world. This deprived the imams of their main external income. The Qasimid state has been characterized as a "quasi-state" with an inherent tension between tribes and government, and between tribal culture and learned Islamic morality. The imams themselves adopted the style of Middle East monarchies, becoming increasingly distant figures. As a result, they eventually lost their charismatic and spiritual position among the tribes of Yemen. The weakening of the imamic state became increasingly acute in the wake of the Wahhabi invasions, after 1800. Tihama was lost for long periods, being contested by lowland Arab chiefs and Egyptian forces. The imamate was further eclipsed by the second coming of the Turks to lowland Yemen in 1849, and to the highlands in 1872.

Second Ottoman period (1872–1918)
Ottoman interest in Yemen was renewed in the mid-19th century. One aim was to increase Ottoman influence in the Red Sea trade, especially since the British occupied Aden since 1839. The opening of the Suez Canal in 1869 increased this incentive. The Tihama was occupied in 1849, but an expedition to San'a miscarried. Meanwhile, the period after 1849 saw a confused series of clashes between various claimants to the imamate in San'a and Sa'dah. The chaos played the Turks in the hands, and in 1872 a new expedition secured San'a with the cooperation of some Zaydi claimants. Nevertheless, claimant-imams continued to resist the Turkish efforts to govern Yemen, and only part of the country was effectively controlled. The modernization attempts of the late Ottoman Empire engendered dissatisfaction among strongly traditional circles, who branded such policies as un-Islamic. An agreement with the rebellious imam Imam Yahya Hamidaddin was finally reached in 1911, whereby the latter was recognized as head of the Zaydis while the Turks collected taxes from their Sunni subjects. Meanwhile, Turkish and British interest clashed in Yemen. It was agreed in 1902 to demarcate the border between the respective spheres of interest, and an agreement was signed in 1914. This was the backdrop to the later division in two Yemeni states (up to 1990). By this time the Ottoman Empire had few years left to go. The dissolution of the empire after World War I led to a complete withdrawal in 1918.

Mutawakkilite Kingdom (1918–1962)
See also Federation of Arab Emirates of the South and Federation of South Arabia.

After 1891 the Hamid ad-Din branch of the Qasimids lay claim to the imamate. In the early 20th century Imam Yahya scored significant successes against the Turkish forces, leading to the truce of 1911. During World War I Imam Yahya nominally adhered to the Ottomans, but was able to establish a fully independent state in 1918. It is known as the Mutawakkilite Kingdom after the laqab name of Imam Yahya, al-Mutawakkil. Yahya pacified the tribes of the Tihama with heavy-handed methods. He also tried unsuccessfully to incorporate Asir and Najran in his realm (1934). These regions were, however acquired by Saudi Arabia. South Yemen stayed under British control until 1967 when it became an independent state. Yahya enjoyed legitimacy among the Zaydi tribes of the inland, while the Sunni population of the coast and southern highlands were less inclined to accept his rule. In order to maintain power he acted as a hereditary king and appointed his own sons to govern the various provinces. Dissatisfied subjects, forming the Free Yemeni Movement, murdered Imam Yahya in 1948 with the aim to create a constitutional monarchy. However, his son Ahmad bin Yahya was able to take over power with the help of loyal tribal allies. He henceforth kept his court in Ta'izz rather than San'a.

The conservative rule of the imam was challenged by the rise of Arab nationalism. Yemen adhered to the United Arab Republic proclaimed by Egyptian president Nasser in 1958, joining with Egypt and Syria in a loose coalition called the United Arab States. However, the imam withdrew when Syria left the union in 1961. Pro-Egyptian militaries began to plot against the ruler. When Ahmad bin Yahya died in 1962, his son Muhammad al-Badr was quickly deposed as the plotters took over San'a. The Yemen Arab Republic was proclaimed. Muhammad al-Badr managed to escape to the loyalists in the highlands, and a civil war followed. Saudi Arabia supported the imam while Egypt dispatched troops to prop up the republicans. After Egypt's defeat against Israel in 1967, and the formation of a socialist people's republic in South Yemen in the same year, both intervening powers tried to find a solution in order to have their hands free. An agreement was finally reached in 1970 where the royalists agreed to accept the Yemen Arab Republic in return for influence in the government.

For developments after 1970, see the article Modern history of Yemen.