Tens of thousands of foreign nationals are believed to have travelled to Syria and neighbouring Iraq to fight for the Islamic State (IS) group.
With the end of the IS territorial "caliphate" imminent, the US has led calls to repatriate the hundreds of men women and children who have been detained on the battlefield. However, many countries have so far been reluctant to do so.
Why did they want to go to Syria and Iraq?
Jihadists began travelling to Iraq in 2003 when a US-led invasion that toppled Saddam Hussein's regime triggered a Sunni insurgency. Hundreds are thought to have joined al-Qaeda in Iraq, a precursor to IS.
Many more went to Syria after a civil war erupted there in 2011. Their presence complicated the conflict and helped make it overtly sectarian in nature, pitching the country's Sunni majority against President Bashar al-Assad's Shia Alawite sect.
There was a huge surge in arrivals after IS seized control of swathes of Syria and Iraq in 2014 and urged Muslims to migrate to their new "caliphate".
How many foreigners joined IS?
The United Nations has said that more than 40,000 foreign fighters from 110 countries may have travelled to Syria and Iraq to join terrorist groups.
A July 2018 study by the International Centre for the Study of Radicalisation (ICSR) at King's College London based on official, academic and other data concluded that 41,490 people - 32,809 men, 4,761 women, and 4,640 children - from 80 countries were affiliated with IS specifically.
Researchers found 18,852 came from the Middle East and North Africa, 7,252 from Eastern Europe, 5,965 from Central Asia, 5,904 from Western Europe, 1,010 from Eastern Asia, 1,063 from South-East Asia, 753 from the Americas, Australia, New Zealand, 447 from Southern Asia, and 244 from Sub-Saharan Africa.
Approximately 850 people from the UK were among them, including 145 women and 50 children.
How many are dead?
The US-led Global Coalition to Defeat IS, which has provided air support and military advisers to local forces in Iraq and Syria since 2014, has said it believes the vast majority of IS militants are dead or in custody. But it has declined to speculate on the number of foreign fighters who may have been killed.
The head of MI5 said in October 2017 that more than 130 Britons who had travelled to Iraq and Syria to fight with IS had died.
What about those in custody?
An official from a US-backed alliance of Kurdish and Arab militias, the Syrian Democratic Forces (SDF), said on 18 February that it had about 800 foreign fighters from almost 50 countries in its prisons. At least 700 women and 1,500 children were being held at camps for displaced people, Abdul Karim Omar added.
Few of the SDF's detainees have been identified. But El Shafee Elsheikh and Alexanda Kotey, are among six from the UK to have been named. The pair are alleged to have been part of an IS execution cell dubbed "the Beatles" that beheaded at least 27 Western hostages.
Mr Omar reiterated that the SDF wanted the foreign fighters to be repatriated. He warned that they were a "time bomb", saying an attack on northern Syria by Turkey - which has vowed to crush a Kurdish militia that dominates the SDF - could spark chaos and allow the jihadist to escape.
However, their home countries have raised concerns about bringing hardened IS members back and the challenges of gathering evidence to support prosecutions.
There are believed to be another 1,000 foreign fighters of various, sometimes undetermined, nationalities under arrest in Iraq, according to the UN.
It is not clear whether that figure includes women and children. But a group of more than 1,300 of them are known to have been detained near Tal Afar in 2017.
Human Rights Watch said at least 72 of those women had been put on trial by June 2018, accused of illegal entry and being a member of, or assisting, IS. Most of them, it added, had been found guilty and sentenced to death or to life in prison. They were from a number of countries, including Turkey, Russia, France and Germany. Children aged nine and above have also been prosecuted.
How many foreigners are still fighting?
After five years of fierce and bloody battles, Syrian and Iraqi forces, backed by world powers, have driven IS out of almost all of the territory it once controlled.
However, UN Secretary General António Guterres told the Security Council at the start of February 2018 that IS was reported to still control between 14,000 and 18,000 militants in Iraq and Syria, including up to 3,000 foreigners.
Mr Guterres published his findings as the SDF launched an offensive to capture the last pocket of territory controlled by IS in Syria.
Foreigners who have fled the fighting around the village of Baghuz and been detained by the SDF include the British teenager Shamima Begum, who was 15 when she ran away from her home to join IS.
Have any returned home?
ICSR researchers found that at least 7,366 foreigners affiliated with IS had travelled back to their own countries, including 256 women and up to 1,180 children.
By June 2018, 3,906 had returned to countries in the Middle East and North Africa, 1,765 to Western Europe, 784 to Eastern Europe, 338 to Central Asia, 308 to South-Eastern Asia, 156 to Southern Asia, 97 to the Americas, Australia and New Zealand, and 12 to Sub-Saharan Africa.
Of the 425 who returned to the UK, only two women and four children were confirmed, according to the ICSR.
The UN has expressed concern about returnees becoming active again on release from prison or for other reasons. It has also said radicalised women and traumatised minors may pose a threat.