Civilian casualties in Afghanistan have hit a new high, including a ten-fold increase in casualties from attacks linked to Islamic State (IS) militants.
In its annual report, the UN said 3,498 civilians were killed and 7,920 wounded in 2016, a 3% rise on 2015.
The number of children killed or injured jumped by a quarter to its highest level to date.
Ground fighting between militants and troops in civilian areas was the main cause of civilian casualties, it said.
Overall, the report attributed almost two thirds of civilian casualties to what it called anti-government elements, mainly the Taliban, and a quarter to pro-government forces.
UN Special Representative for Afghanistan Tadamichi Yamamoto described the civilian deaths as "deeply harrowing and largely preventable".
"The escalation in ground fighting and overall insecurity, compounded by a lack of respect for human rights and international humanitarian law by parties to the conflict, particularly anti-government elements, led to an overall deterioration in civilian protection," the report said.
The UN began documenting civilian casualties in Afghanistan in 2009.
Who caused the most casualties?
The UN attributed a total of 6,994 civilian casualties (2,131 deaths and 4,863 injured) to anti-government elements.
It blamed most of these on the Taliban.
The UN listed leading causes of deaths and injuries as IEDs, suicide and co-ordinated attacks, and ground fighting where casualties were attributed solely to militants.
But the report found that the steepest proportional rise came from attacks attributed to Islamic State (IS) militants. It said the group was behind 899 deaths and injuries, up from 82 in 2015.
Does this mean the threat from IS is growing?
To date IS has been a relatively minor faction in Afghanistan. The group, which announced it was expanding into Afghanistan in January 2015, has secured footholds in at least four districts in mountainous Nangarhar province, east of Kabul on the border with Pakistan.
But in the face of armed opposition from Afghan troops and the Taliban, it has not managed to move permanently beyond that.
Since mid-2016, however, it appears to have changed tactics, demonstrating what the UN called an "increased ability to conduct large, deadly attacks against civilian targets in Kabul".
What has IS done?
The UN said that before mid-2016, all IS-related civilian casualties had been in Nangarhar. But in July IS carried out the first of four attacks on civilians in Kabul, when twin blasts targeting a protest march by members of the Shia Muslim minority group killed at least 80 people.
Afghanistan has not experienced levels of sectarian violence seen in Pakistan and Iraq, but analysts say IS attacks on Shia Muslims appear to be a concerted new attempt to fracture national unity.
Why were so many children killed or hurt?
Tadamichi Yamamoto highlighted the "alarming increase" in child casualties in 2016, as the UN documented 3,512 child casualties (923 deaths and 2,589 injured), a 24% increase compared with 2015.
Most child casualties were caused by ground fighting in civilian-populated areas.
The report emphasised a 65% increase in child casualties from the detonation of explosive remnants of war, saying it was "extremely concerned by the persistent failure of [parties to the conflict] to mark and clear unexploded ordnance from the battlefield following ground fighting in civilian-populated areas".
The report described one incident that occurred on 16 July in Pul-i-Khumri district, in Baghlan province which killed a girl and three boys.
"I saw our neighbour, a boy who later died, holding something made of metal. I knew that it was something explosive. He told all of us 'I'm going to detonate it'," the report quoted a 13-year-old girl as saying.
"He began hitting the object with a stone. It exploded. I fell unconscious and I don't know what happened next."
What about pro-government forces?
Almost a quarter of the civilian casualties were attributed to pro-government forces, the majority to Afghan security forces. Many of these were caused by troops' use of mortars and artillery during ground operations in populated areas.
The number of deaths and injuries caused by air strikes also rose by 99% to levels last seen in 2009. The UN said 250 people were killed and 340 injured in air strikes in 2016, with responsibility relatively evenly split between Afghan and international aircraft.
Meanwhile, a report released earlier this month by an official US watchdog said the death rate amongst Afghan troops was soaring.
The report by the US government's Special Inspector General for Afghanistan Reconstruction (SIGAR) said 6,785 Afghan soldiers and police officers were killed between 1 January and 12 November - an increase of about 35% on the whole of 2015 - as they struggled to retain control of parts of the country.