Iraq is a country in the Middle East, which has had a complex and troubled relationship with its neighbours and the West since independence from the UK in 1932. Iraq has three major Ethnic and religious groups: Sunnis, Shias and Kurds. Under the Ottoman Empire fell, they were ghettoed into three districts with their own local governments (Mosul, Baghdad and Basra).
Iraq was a site of significant battles in both World Wars, and will likely play a role in the third.
Iraq, whose definition is ultimately tied to the ancient region of Mesopotamia, contains the now-deserted first cities of civilisation - Akkad, Ur, Nineveh and many others - built by a succession of cultures, some of which predate 4004 BC. They were the earliest known societies to use writing and accounting, codify their laws, and develop basic astronomy and mathematics. Eventually the region became the centre of the powerful Assyrian and Babylonian empires, the latter of which features prominently in the Old Testament on account of its conquest of ancient Israel and transportation of the Jews from their homeland. Eventually the area was itself conquered, by Rome and Persia.
Sunni delight and Shia bliss
In 633 CE, Asuristan (Persian form of "Assyria"), as it was then called, was conquered by Arab forces spreading Islam, their shiny new religion, which soon split into Sunni and Shia factions, especially after the battle of Karbala (now in Iraq) in 680. Baghdad became the purpose-built capital of the huge Abbasid Caliphate in 762, and a famed centre of learning, but after a Mongol invasion in 1258 its influence declined. Iraq eventually became a mere province of the Ottoman Empire until the twentieth century.
The Ottoman Empire collapsed after the First World War. The British "unified" it into a single country, called Iraq, and put a Hashemite-descended Royal family in power. They then cut off a small, oil rich Sunni/Wahabi part from the south and called it Kuwait.
The King was overthrown in a series of coups, which lasted until the Sunni-led Ba'ath Party—with the support of the United States—took over in '68. At first, the party answered to the new President, but over the years it was subsumed by one Saddam Hussein. Fast-forward to 1980: Saddam provokes a war with the fresh-out-of-revolution Iran over fear that a Shia revolution would expand to the oppressed Shias in Iraq. The thing is, the US was selling weapons to both sides to keep things even, since they thought that a single country controlling mideast oil would be dangerous.
By 1990, the Baathists had become an embarrassment to the US. However (as Thomas Friedman pointed out), under the Ottomans the tribes were sectioned off from each other, and under Saddam they were suppressed enough not to cause problems. But with no government, and tons of military infrastructure from the armed forces of a failed state, they could finally express their dislike for each other. President Bush knew this, so he chose not to remove Saddam after kicking the Iraqis out of Kuwait. In 2003, using fake evidence, his son Invaded Iraq and overthrew Saddam. Smart.
It was an open secret that Iran was arming and training Shi'ite militias, such as the Jaysh al-Mahdi (Mahdi Army) and in some cases attacked coalition forces directly. From Sadr City, the predominant Shi'ite quarter of Baghdad, the Mahdi Army with weapons and assistance from Iran, launched mortar and rocket attacks into the government quarter, also known as the Green Zone.
After being chased out of Afghanistan in 2003, Abu Musab al-Zarqawi relocated his Organisation of Monotheism and Jihad to Iraq. During protracted negotiations with al-Qaeda's leadership, Zarqawi persuaded bin Laden to abandon his temporary alliance with Iran and support Zarqawi's efforts to destabilize the growing Shi'ite and Iranian control over Iraq. The Group subsequently was awarded the Al Qaeda in Iraq (AQI) franchise, later becoming the Islamic State. In order to make Iraq ungovernable for U.S. occupiers, Zarqawi sparked a Sunni-Shi'ite sectarian war, indiscriminately killing hundreds of innocents with car bombs and many other deadly devices. The bombings were staged to simulate a missile strike. In the immediate confusion after a bombing, jihadi clerics would appear to blame the United States for the attacks.
After Zarqawi was killed by an airstrike in 2006, the United States organized the Iraqi Awakening Council - about 130 Sunni tribal militias totaling about 100,000 men - to counter the AQI (renamed the Islamic State in Iraq) insurgency. This period is also known as "the surge".
Many Sunni tribes, while abhorring the senseless violence of the jihadis, were also untrusting of the Shi'ite led Baghdad government. When the American forces withdrew in 2011, the Sunni tribes who took part in the Awakening Council were left to swear allegiance to the Islamic State, or accept their fate.
The de-Ba'athification process headed by Ahmad Chalabi, a Shi'ite, excluded many former Saddam military commanders from serving in the new Iraqi Army or running for seats in the Iraqi Parliament. In Zarqawi's words, "the Shi`a have put on the uniforms of the Iraqi army, police, and security [forces] and have raised the banner of preserving the homeland and the citizen. Under this banner, they have begun to liquidate the Sunnis under the pretext that they are saboteurs, remnants of the Ba'ath, and terrorists spreading evil in the land. With strong media guidance from the Governing Council and the Americans, they have been able to come between the Sunni masses and the mujihadeen." Many Sunnis became disenfranchised. A large number joined insurgent militias, strengthening the anti-government forces while simultaneously stripping the government of its military capabilities.
These secular Sunnis brought Daesh its early success against the American trained and equipped Iraqi Army. Abu Muslim al Turkmani, Abu Mohammad al Sweidawi, and Adnan Ismail Najm, are all former high level military intelligence officers defected to al-Qaeda in Iraq, which later became the Islamic State. They primarily were responsible for Daesh's early military victories.
Iraq National Army was built to fail as some have pointed out; Prime Minister Nouri al-Malaki was fearful of a coup by Saddam's ex-commanders. Untrusting of America's naive interest's in building a unified National Army, America's record of abandoning allies with vague promises of future support, and favoring Iran as the longterm guarantor of security, Maliki's Dawa Party organized it's own militia which reported directly to Maliki's office.
Daesh attacks in Iraq initially escalated during the Hawija election violence of April 2012 in which scores were killed. In what began as peaceful protests by local Sunnis for reform of de-Ba'athification Laws, Daesh provocateurs instigated violence and the Baghdad government of Prime Minister Nouri al-Maliki was much criticized for using the Iraqi National Army to restore order. However, it is worth noting that Maliki used brutal tactics to quash dissent, namely massacring Sunnis by the hundred, then saying they were terrorists. This was a main reason why Daesh gained popular support among Sunnis.
In early June 2014 Daesh staged a blitzkrieg across the Sykes-Picot line and seized the cities of Mosul, Tikrit, Baiji, and al-Qa'im. Iraqi Prime Minister Nouri al-Maliki, frustrated with the demoralized Iraqi military, met on 15 June 2014 in Baghdad with the commander of the Iranian Quds Force, Gen. Qasem Soleimani. Kurdish sources reported the general was drafting a coordination strategy for Iraq. The next day, Maliki dismissed four of Iraq’s military leaders for failing to perform their “national duty”. Iraq's most senior Shi'ite cleric, Ayatollah Ali al-Sistani, issued a fatwa on the obligation to defend the country from Daesh. Most volunteers flocked to various private militias, leaving behind the U.S. supported and defeated Iraqi National Army. In less than one day, Sistani organized enough militia men to equal division strength of a regular army. The Iraqi press dubbed it al-hashad al-sha'abi (the popular mobilization). The Iranian backed Shi'ite militias based in Iraq call themselves al-muqawama al-islamiya (the Islamic resistance).
In the war between Daesh, the Iranian Quds Force and Iranian-backed Shi'ite militias fought in the territory of Iraq, all belligerents categorically rejected the notion of "rules of engagement" characteristic of American and Western military doctrines, regulated by the Geneva conventions. Virtually all belligerents, even some of a secular nature, sanctioned the use of suicide bombers, though few Shias actually became suicide bombers, whereas Sunnis regularly suicide bombed civilians in Baghdad and other areas on a daily basis. However, everyone generally accepts that Shia militias organized by Iran played a large role in defeating Daesh in Tikrit and Baiji, though there victories would have been near-impossible without US air support.
Since June, Daesh has been pushed out of the towns of Jalawla, Muqdadiya, Zumar, Sinjar, Baiji, and Tikrit, but it pushed back in Baiji, as well as capturing the city of Ramadi, a huge operations hub for Iraqi forces in Anbar province. Ramadi has since been retaken from Daesh, with Fallujah following a few months thereafter. It continues to hold Mosul, Tal Afar, Hawija, and al-Qa'im, inside Iraq, roughly 1/4 of the country. An offensive launched in mid 2016 liberated large portions of Sunni countryside and helped page the way for the eventual Mosul siege. 
- How the British bombed Iraq in the 1920s
- Hersh, Seymour, "U.S. Secretly Gave Aid to Iraq Early in Its War Against Iran", NYT 26 January 1992.
- Hearings before the Committee on Foreign Relations. U.S. Senate. January 23, 2007. Statement by Edward N. Luttwak, p.3. 
- Statement by Edward N. Luttwak, p.7.
- Saddam's Ex-Officer: We've Played Key Role In Helping Militants, Leila Fadel, June 19, 2014. npr.org