The Ottoman Empire entered Yemen in 1538 when Suleiman the Magnificent was Sultan. Under the military leadership of Özdemir Pasha, the Ottomans conquered Sanaa in 1547. With Ottoman approval, European captains based in the Yemeni port towns of Aden and Mocha frequented Sanaa to maintain special privileges and capitulations for their trade. In 1602 the local Zaydi imams led by Imam al-Mu'ayyad reasserted their control over the area, and forced out Ottoman troops in 1629. Although the Ottomans fled during al-Mu'ayyad's reign, his predecessor al-Mansur al-Qasim had already vastly weakened the Ottoman army in Sanaʽa and Yemen. Consequently, European traders were stripped of their previous privileges.