KABUL, Afghanistan — Even with peace talks underway, the war in Afghanistan killed almost 4,000 civilians last year, including a record number of children, officials said Sunday, making it the single deadliest year for Afghan civilians since the United Nations began documenting casualties a decade ago.

In a report released Sunday, the United Nations attributed almost two-thirds of civilian casualties — 63 percent — to insurgent groups, primarily the Taliban and the Islamic State. Afghan and American forces were responsible for 24 percent — 14 percent by Afghan national security forces, 6 percent by American forces and 4 percent by government-backed armed groups. Responsibility for the rest could not be established.

The single biggest cause of civilian casualties was suicide bombings and related attacks by insurgents, the report found. The numbers of civilian casualties caused by suicide bombings and by American and Afghan government airstrikes were each the highest recorded since the United Nations issued its first report in 2009.

The figures reflected a surge in fighting as both sides in the conflict, which is in its 18th year, stepped up attacks as they sought leverage in peace talks between the United States and the Taliban.