US forces are once again playing a major role in the country as part of the war against the Islamic State.
Here a three key questions on the fifth anniversary of US troops leaving Iraq.
Why did US forces leave in 2011?
After a nearly nine-year presence, negotiations on the United States leaving a residual training force in Iraq after the end of 2011 broke down over the issue of American forces having legal immunity from Iraqi prosecution, which Washington demanded and Baghdad was reluctant to provide.
The US then announced that American forces would depart, an operation that was completed on December 18, 2011 when the last convoy of armoured vehicles crossed into neighbouring Kuwait.
The withdrawal brought political benefits to both Washington and Baghdad: US President Barack Obama wanted to end the Iraq war, which he had opposed, and the withdrawal also allowed then-premier Nuri al-Maliki's government to claim credit for ending the unpopular American presence in the country.
Some American military personnel and contractors did however remain in Iraq under US embassy authority as part of the Office of Security Cooperation - Iraq, which worked on training the country's forces and helping it field American military equipment.
What went wrong?
Prior to the withdrawal, American officials repeatedly stated that Iraqi forces were ready to handle internal security, but unrest worsened considerably in the years after their departure, culminating in the disastrous IS offensive in 2014.
One of the main reasons for the rising violence was widespread anger among Iraq's Sunni Arab minority, members of which complained of being marginalised and targeted by the Shiite-led government.
This anger -- which was stoked by military raids and detentions in Sunni areas, efforts to arrest several prominent Sunni politicians, and a sometimes heavy-handed response to anti-government protests -- increased sympathy for militant groups and made it easier for them to operate.
According to the US, Iraqi forces did not carry out the necessary training to maintain their readiness after American forces left -- a view corroborated in an Iraqi parliamentary report on causes of the fall of second city Mosul to IS.
The civil war in neighbouring Syria, which broke out in 2011, also provided a key safe haven for jihadists to regroup, expand their ranks, train, and gain combat experience.
What are US forces doing in Iraq now?
American military forces are carrying out air and artillery strikes against IS in Iraq as part of a US-led coalition against the jihadists, and have provided training, advice and other assistance to Baghdad's forces.
American special forces personnel have also fought IS on the ground, and three members of the US military have been killed in the country.
There are about 5,000 American military personnel in Iraq, according to the coalition.