Safavid shah Ismail I took the Baghdad region from the Aq Qoyunlu in 1508.[4] After the Safavid takeover, Sunni Muslims, Jews and Christians became targets of persecution, and were killed for being infidels.[4] In addition, Shah Ismail ordered the destruction of the grave of Abu Hanifa, founder of the Hanafi school of law which the Ottomans adopted as their official legal guide.[4]
For a time, Baghdad had been the largest city in the Middle East. The city saw relative revival in the latter part of the 18th century under a largely autonomous Mamluk government. Direct Ottoman rule was reimposed by Ali Ridha Pasha in 1831. From 1851 to 1852 and from 1861 to 1867, Baghdad was governed, under the Ottoman Empire by Mehmed Namık Pasha. The Nuttall Encyclopedia reports the 1907 population of Baghdad as 185,000.