Halabja has a long history, as proven by excavations at nearby archaeological sites like Bakr Awa. The cemetery includes the tombs of several historical figures, such as Ahmed Mukhtar Jaff, Tayar Bag Jaff and Adila Khanim. In August 2009, three 17th century tombs were discovered in the Ababile district of the town.
This suggests that the town is somewhat older than indicated by some sources, which claim that it was built by the Ottoman Empire at about 1850. However, modern developments date from the early 20th century. The post office opened in 1924 and the first school opened the following year. The Qaysari Pasha and Hamid Bag bazaars were built in 1932. Electricity did not reach the city until 1940.
At the beginning of the 20th century, there were many British soldiers stationed in Halabja. During World War I, Adela Khanum saved the lives of several British soldiers, resulting in the British honoring her with the title Khan Bahadur, Princess of the Brave. She was also responsible for the building of a new prison, setting up a court of justice, of which she was the first president and building a new bazaar.
The Kurdish peshmerga guerrillas, supported by Iran, liberated Halabja in the final phase of the Iran–Iraq War. At 11:00 AM, On March 16, 1988, after two days of conventional artillery attacks, Iraqi planes dropped gas canisters on the town. The town and surrounding district were attacked with bombs, artillery fire and chemical weapons, the last of which proved most devastating. At least 5,000 people died as an immediate result of the chemical attack and it is estimated that a further 7,000 people were injured or suffered long term illness. Most of the victims of the attack on the town of Halabja were Kurdish civilians.
The attack is believed to have included the nerve agents Tabun, Sarin and VX, as well as mustard gas. Though, according to the former senior CIA analyst Stephen C. Pelletiere, Iraq did not have the nerve agent used in the attack but did have mustard gas which was used in the Iran–Iraq War. It is occasionally suggested that cyanide was also included among these chemical weapons, though this assertion has been cast into doubt, as cyanide is a natural byproduct of impure Tabun. The attack on Halabja took place amidst the infamous Anfal campaign, in which Saddam Hussein violently suppressed Kurdish revolts during the Iran–Iraq War.
Before the war ended the Iraqis moved in on the ground and completely destroyed the town. In March 2010, the Iraqi High Criminal Court recognized the Halabja massacre as genocide; the decision was welcomed by the Kurdistan Regional Government.
In the mountains to the west of Halabja, a militant Islamist group, Ansar al-Islam, occupied a small enclave in the period of 2000–2003. The area was overrun by Peshmerga forces from the Patriotic Union of Kurdistan (PUK), with U.S. air support, at the beginning of the 2003 invasion of Iraq. The town has remained a center of Islamism in the Kurdistan region, however.
Just before Kurds gained some autonomy over the Iraqi Kurdistan region in 1991, which included Halabja, a new town was set up where some former Kurdish refugees later relocated. The new town called Halabja Taza (or New Halabja) today has an estimated 9,000 homes.
The Kurdistan Regional Government made some concentrated reconstruction efforts after 2003 in the old town and began rebuilding some of the bombed-out homes in Halabja and paving new roads. A memorial was also constructed for the victims of the chemical attacks. However, residents of Halabja have complained about the continued lack of basic services and necessities.
On the 2006 anniversary of the gas attack, violent demonstrations erupted in Halabja. An estimated 7,000 demonstrators protested against priorities in reconstruction, claiming that officials were not sincerely addressing the problems of the gas attack victims. Roadblocks were set up and the gas attack memorial museum was set afire. Police fired at protesters killing one 14-year-old boy and wounding many others.
On 12 November 2017 at 21:18 local time, an earthquake struck approximately 32 kilometres (20 mi) south-southwest of Halabja.