Islamic State and the crisis in Iraq and Syria in maps
The US-led coalition against so-called Islamic State (IS) says 98% of territory once claimed by the jihadist group across Iraq and Syria has been recaptured.
Iraq's government announced in December 2017 that its war against IS was over, almost four years after the group first seized parts of the country.
That month also saw Russia's President Vladimir Putin announce a partial withdrawal of Russian troops from Syria, after IS was left controlling only a few pockets of land.
The capture of Raqqa by a US-backed alliance of Syrian Kurdish and Arab fighters in October was seen as a major victory in the battle against IS. The city was the de facto capital of the "caliphate" the group declared.
A few months earlier, in July 2017, Iraqi government forces retook the second city of Mosul, which fell to IS in 2014 when militants routed the Iraqi army.
At its peak, some 10 million people were living in territory under IS control.
The battle for Raqqa
Interactive The Clock tower roundabout in central Raqqa where IS performed several public executions
An intensive aerial bombardment by the US-led coalition helped secure victory in Raqqa for the Syrian Democratic Forces (SDF), which was formed in 2015 by the the Kurdish Popular Protection Units (YPG) militia and a number of smaller, Arab factions. Since early June, coalition planes have carried out almost 4,000 air strikes on the city.
Estimates of the number of casualties vary. The Syrian Observatory for Human Rights, a UK-based monitoring group, said at least 3,250 people had been killed, among them 1,130 civilians. Other groups say the total was higher.
The UN estimates about 270,000 people fled their homes during the SDF offensive.
The immense task of rebuilding the city may take years. Clearing operations are already under way to uncover any jihadist sleeper cells and remove landmines.
Interactive The stadium was the hub of IS intelligence operations in Raqqa
Rebuilding Mosul is being seen as a major challenge for the Iraqi government. One Iraqi official estimated it would cost $1bn, others have put the figure far higher.
The top US commander in Iraq has also urged the government to "reach out and reconcile with the Sunni population" to prevent "ISIS 2.0 from emerging".
How did IS spread across Iraq and Syria?
The jihadists exploited the chaos and divisions within both Syria and Iraq.
IS grew out of what was al-Qaeda in Iraq, which was formed by Sunni militants after the US-led invasion in 2003 and became a major force in the country's sectarian insurgency.
In 2011, the group joined the rebellion against President Bashar al-Assad in Syria, where it found a safe haven and easy access to weapons.
At the same time, it took advantage of the withdrawal of US troops from Iraq, as well as widespread Sunni anger at the sectarian policies of the country's Shia-led government.
In 2013, the group began seizing control of territory in Syria and changed its name to Islamic State in Iraq and the Levant (Isis or Isil).
The following year, Isis overran large swathes of northern and western Iraq, proclaimed the creation of a "caliphate", and became known as "Islamic State".
A subsequent advance into areas controlled by Iraq's Kurdish minority, and the killing or enslaving of thousands of members of the Yazidi religious group, prompted the US-led coalition to begin air strikes on IS positions in Iraq in August 2014.
As IS is now being forced out of Iraq and Syria, another problem is the likely resurgence of hostilities between rival groups. In October 2017, Iraqi forces pushed Kurdish Peshmerga fighters back from land they took during the fight against IS around Kirkuk.
Exact numbers of casualties from the conflict with IS are not available.
The UN says at least 3,298 civilians were killed in acts of violence in Iraq in 2017, fewer than the 2016 total of 6,878 - although the true figure is likely to be higher as the organisation has been unable to verify some reports of casualties in the Mosul area.
According to Iraq Body Count, the total number of civilian deaths in Iraq since 2014 stood at 68,260 up to the end of February 2018. The annual number of casualties has decreased slightly each year since 2014, from a high of 20,218 in that year to 13,187 in 2017.
The UN no longer keeps track of casualty figures in Syria due to the inaccessibility of many areas and the conflicting reports from the various parties to the war there.
The Syrian Observatory for Human Rights, a UK-based monitoring group, reported in March 2018 that it had documented the deaths of more than 353,900 people, including 106,000 civilians, since the uprising against President Bashar al-Assad began 2011.
But it noted that the figure did not include 56,900 people who were missing and presumed dead. It estimated a further 100,000 deaths had not been documented.
Who is fighting IS?
The US-led coalition has conducted more than 13,300 air strikes against IS targets in Iraq since August 2014.
Most attacks have been carried out by US aircraft, but those from Australia, Belgium, Denmark, France, Jordan, the Netherlands and the UK have also taken part. By the end of 2017, 74 countries were said to have joined the US-led coalition fighting IS in Iraq and Syria.
In Syria, the air campaign began in September 2014. Since then, more than 14,600 strikes have been carried out by coalition forces, which include Australia, Bahrain, France, Jordan, the Netherlands, Saudi Arabia, Turkey, United Arab Emirates and the UK.
The number of strikes each month rose steadily in Iraq up to a peak in January 2016 and then began to fall as the number of strikes in Syria increased dramatically, reaching a high of just over 1,400 in August 2017.
Russia is not part of the coalition, but its jets began air strikes against what it called "terrorists" in Syria in September 2015.
There is little information from official sources about the Russian air strikes. The Institute for the Study of War said evidence suggested Russian planes targeted deep into opposition-held territory, and helped Syrian government forces to retake control of the city of Aleppo in December 2016.
However, Russia warned the US coalition that it would treat its aircraft as targets after the US shot down a Syrian military plane during the assault on Raqqa. The incident led to a suspension of communications between the two sides aimed at avoiding clashes in the air.
Global reach of IS
With the proclamation of a caliphate at the end of June 2014, IS signalled its intention to spread beyond Iraq and Syria.
By August 2016, IS was reported to be operational in 18 countries across the world, including Afghanistan and Pakistan, according to evidence seen by the US National Counterterrorism Center. It also found signs of what it called "aspiring branches" in Mali, Egypt, Somalia, Bangladesh, Indonesia and the Philippines.
Since 2016, IS has claimed attacks in a number of countries, including Egypt, Turkey, Indonesia, France, Belgium, Germany, the US, Finland and Bangladesh. In 2017, IS claimed to be behind at least two attacks in the UK.
The proclamation of the caliphate triggered a surge in the number of foreign fighters travelling to Syria and Iraq to join IS.
According to the head of the UK's intelligence service, MI5, more than 800 people have travelled from UK to join the conflict in Iraq and Syria - and 130 of them had died.
How does IS get its funding?
Oil was once the biggest single source of revenue for IS. The group seized control of many oil fields in Syria and Iraq, and sold oil on the black market.
But revenue has fallen since IS lost control of oil-producing areas in northern Syrian and western Iraq, and US-led coalition and Russian air strikes began targeting oil infrastructure.
Income from taxes and fees has also fallen as IS has lost control of major cities like Mosul and Raqqa.
Money obtained by looting and fines initially increased, especially when IS seized Mosul in 2014, but has since declined.
At one point, IS was reported to be so short of funds that it was imposing random fines for offences like driving on the wrong side of the road.
According to a report by IHS Markit, territorial losses are the main factor contributing to IS's loss of revenue. It says the group's ability to compensate for financial losses by increasing the fiscal burden on the population it controls appears to have reached its limits.
Where are the refugees?
More than 5.6 million Syrians have fled abroad to escape the fighting in Syria, according to the UN. Most have ended up in neighbouring Turkey, Lebanon and Jordan.
Almost one million Syrians applied for asylum in Europe between April 2011 and July 2017, according to UN figures.
There are also estimated to be 6.1 million Syrians who have been displaced inside Syria and are living in camps or other makeshift accommodation.
For the first time since the beginning of the crisis in Iraq in December 2013, the number of people returning to their area of origin in the country has surpassed the number of people displaced in the country. By the end of 2017, some 3.2 million people had returned home, while a 2.6 million remained displaced, according to the International Organization for Migration.