In the early 11th century, the city was under the
Banu Uqayl and later the
Annazids until
Ibrahim Inal captured the city around 1045. Khanaqin was part of
Baban until the 1850s. The population of Khanaqin in the mid-19th century was small with only fifty Muslim and five
Jewish households, with a significant Kurdish tribal population around the town. It had three mosques and three
caravanserais. Khanaqin was a mere caravan station for caravans carrying Shia pilgrims before the
Treaty of Erzurum in 1847 which made it a more significant frontier town between the
Ottoman Empire and
Qajar Iran. An immigration office was established just after the signing of the treaty to manage the growing pilgrimage. A
customs house would later be established as well. During the
Persian Campaign, the Ottomans were
attacked in Khanaqin on 3 June 1916 by
Russian forces led by
Nikolai Baratov but managed to push back the Russian cavalry. While the Ottomans lost about 300 men, the Russian casualties were greater. However, the Russians succeeded in capturing the town in April 1917 due to Ottoman weakness and the collapse of the Iranian government. Russia received support from the Kurdish tribes and allowed them to govern the area. Nonetheless, the Russian forces had to withdraw from the area in June 1917 due to the
Russian Revolution which allowed the Ottomans to retake the town. The
United Kingdom captured the city in December 1917 during their
Mesopotamian campaign. After the capture, Britain approached the regional Kurdish tribes including
Bajalan leader
Mustafa Pasha Bajalan to consolidate their control.
Khanaqin District was established in 1921. Khanaqin saw no fighting during
World War II but became an important base for
Commonwealth forces and a
field hospital was constructed in the town. Many
Polish prisoners of war, who escaped Russia and attempted to link up with Commonwealth forces in Khanaqin, arrived at the town in September 1942. They would remain in the town but many perished and a cemetery was built in the town for them. Maintenance of the Khanaqin War Cemetery was later abandoned and a memorial was built in
Baghdad. In 2020, the cemetery was damaged by 'extremists'. The town experienced shelling by
Iran during
Iran–Iraq War in the 1980s and its people were displaced. and again in April 2003 during the
U.S. invasion of Iraq. In the
December 2005 parliamentary election, the
Democratic Patriotic Alliance of Kurdistan won the city with 99.4%. In the same year, locals protested and wanted Khanaqin to be a part of the
Kurdistan Autonomous Region under
PUK rule. In September 2008, Peshmerga withdrew from the city allowing Iraqi police to control the city. The town experienced protests against the shuffle. As part of a compromise,
Kurdistan Region was allowed to administer the city with
Asayish presence, but Peshmerga would ultimately enter the city again in September 2011. Peshmerga withdrew from the city again in October 2017 which made the city witness frequent security breaches. ==Climate==