Lala Kara Mustafa Pasha, the Ottoman governor of Syria, was ordered by Selim II to suppress the Yemeni rebels. However, the Turkish army in Egypt was reluctant to go to Yemen due to their knowledge of the hegemony of the northern Yemenis. Mustafa Pasha sent a letter with two Turkish shawishes hoping to persuade al-Mutahhar to give an apology and confirm that Mustafa Pasha did not promote any act of aggression against the Ottoman army, and state that the “ignorant Arabian” according to the Turks, acted on their own. Imam al-Mutahhar refused the Ottoman offer. When Mustafa Pasha sent an expeditionary force under the command of Uthman Pasha, it was defeated with great casualties. Sultan Selim II was infuriated by Mustafa’s hesitation to go to Yemen. He executed a number of sanjak-beys in Egypt and ordered Sinan Pasha to lead the entire Turkish army in Egypt to reconquer Yemen. Sinan Pasha was a prominent Ottoman general of Albanian origin. He reconquered Aden, Taiz, and Ibb, and besieged Shibam Kawkaban in 1570 for seven months. The siege was lifted once a truce was reached. Imam al-Mutahhar was pushed back, but could not be entirely overcome. After al-Mutahhar’s demise in 1572, the Zaydi community was not united under an imam; the Turks took advantage of their disunity and conquered Sana’a, Sa’dah, and Najran in 1583. Imam al-Nasir Hassan was arrested in 1585 and exiled to Constantinople, thereby putting an end to the Yemeni rebellion. The Zaydi tribesmen in the northern highlands particularly those of Hashid and Bakil, were ever the Turkish bugbear in all Arabia. The Ottomans who justified their presence in Yemen as a triumph for Islam, accused the Zaydis of being infidels. Hassan Pasha was appointed governor of Yemen and enjoyed a period of relative peace from 1585 to 1597. Pupils of al-Mansur al-Qasim suggested he should claim the imamate and fight the Turks. He declined at first, but the promotion of the Hanafi school of jurisprudence at the expense of Zaydi Islam infuriated al-Mansur al-Qasim. He proclaimed the imamate in September 1597, which was the same year the Ottoman authorities inaugurated al-Bakiriyya Mosque. By 1608, Imam al-Mansur (the victorious) regained control over the highlands and signed a truce for 10 years with the Ottomans. Imam al-Mansur al-Qasim died in 1620. His son Al-Mu’ayyad Muhammad succeeded him and confirmed the truce with the Ottomans. In 1627, the Ottomans lost Aden and Lahej. ‘Abdin Pasha was ordered to suppress the rebels, but failed, and had to retreat to Mocha. Al-Mu’ayyad Muhammad expelled the Ottomans from Sana’a in 1628, only Zabid and Mocha remained under Ottoman possession. Al-Mu’ayyad Muhammad captured Zabid in 1634 and allowed the Ottomans to leave Mocha peacefully. The reason behind Al-Mu’ayyad Muhammad’s success was the possession of firearms by the tribes and their unity behind him.
In 1632, Al-Mu’ayyad Muhammad sent an expeditionary force of 1,000 men to conquer Mecca. The army entered the city in triumph and killed its governor. The Ottomans were not ready to lose Mecca after Yemen, so they sent an army from Egypt to fight the Yemenites. Seeing that the Turkish army was too numerous to overcome, the Yemeni army retreated to a valley outside Mecca. Ottoman troops attacked the Yemenis by hiding at the wells that supplied them with water. This plan proceeded successfully, causing the Yemenis over 200 casualties, most from thirst. The tribesmen eventually surrendered and returned to Yemen. Al-Mu’ayyad Muhammad died in 1644. He was succeeded by Al-Mutawakkil Isma’il, another son of al-Mansur al-Qasim, who conquered Yemen in its entirety, from Asir in the north to Dhofar in the east. During his reign, and during the reign of his successor, Al-Mahdi Ahmad (1676–1681), the imamate implemented some of the harshest discriminatory laws (ghiyar) against the Jews of Yemen, which culminated in the expulsion of all Jews (Exile of Mawza) to a hot and arid region in the Tihama coastal plain. The Qasimid state was the strongest Zaydi state to ever exist.